mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
fscrypt: clear keyring before calling key_put()
Now that the key quotas are handled immediately on key_put() instead of being postponed to the key management garbage collection worker, a call to keyring_clear() is all that is required in fscrypt_put_master_key() so that the keyring clean-up is also done synchronously. This patch should fix the fstest generic/581 flakiness. Signed-off-by: Luis Henriques <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ebiggers: added comment] Signed-off-by: Eric Biggers <[email protected]>
This commit is contained in:
1 parent
5befc19cae
commit
d3a7bd4200
1 file changed
+6
-2
+6
-2
@@ -74,8 +74,12 @@ void fscrypt_put_master_key(struct fscrypt_master_key *mk)
|
||||
* that concurrent keyring lookups can no longer find it.
|
||||
*/
|
||||
WARN_ON_ONCE(refcount_read(&mk->mk_active_refs) != 0);
|
||||
key_put(mk->mk_users);
|
||||
mk->mk_users = NULL;
|
||||
if (mk->mk_users) {
|
||||
/* Clear the keyring so the quota gets released right away. */
|
||||
keyring_clear(mk->mk_users);
|
||||
key_put(mk->mk_users);
|
||||
mk->mk_users = NULL;
|
||||
}
|
||||
call_rcu(&mk->mk_rcu_head, fscrypt_free_master_key);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user