diff options
Diffstat (limited to 'fs/crypto/keyring.c')
-rw-r--r-- | fs/crypto/keyring.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/crypto/keyring.c b/fs/crypto/keyring.c index 0edf0b58daa7..787e9c8938ba 100644 --- a/fs/crypto/keyring.c +++ b/fs/crypto/keyring.c @@ -18,10 +18,11 @@ * information about these ioctls. */ -#include <asm/unaligned.h> +#include <linux/unaligned.h> #include <crypto/skcipher.h> #include <linux/key-type.h> #include <linux/random.h> +#include <linux/once.h> #include <linux/seq_file.h> #include "fscrypt_private.h" @@ -74,8 +75,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); } |