aboutsummaryrefslogtreecommitdiffstats
path: root/security/keys/proc.c
diff options
context:
space:
mode:
authorElena Reshetova <elena.reshetova@intel.com>2017-03-31 15:20:49 +0300
committerJames Morris <james.l.morris@oracle.com>2017-04-03 10:49:06 +1000
commitddb99e118e37f324a4be65a411bb60ae62795cf9 (patch)
tree9fecb40084bb937fafa04eaf57d9bc4ae3bcb6a9 /security/keys/proc.c
parentsecurity, keys: convert key.usage from atomic_t to refcount_t (diff)
downloadlinux-dev-ddb99e118e37f324a4be65a411bb60ae62795cf9.tar.xz
linux-dev-ddb99e118e37f324a4be65a411bb60ae62795cf9.zip
security, keys: convert key_user.usage from atomic_t to refcount_t
refcount_t type and corresponding API should be used instead of atomic_t when the variable is used as a reference counter. This allows to avoid accidental refcounter overflows that might lead to use-after-free situations. Signed-off-by: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David Windsor <dwindsor@gmail.com> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to '')
-rw-r--r--security/keys/proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/keys/proc.c b/security/keys/proc.c
index 69199f18bfb3..bf08d02b6646 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -340,7 +340,7 @@ static int proc_key_users_show(struct seq_file *m, void *v)
seq_printf(m, "%5u: %5d %d/%d %d/%d %d/%d\n",
from_kuid_munged(seq_user_ns(m), user->uid),
- atomic_read(&user->usage),
+ refcount_read(&user->usage),
atomic_read(&user->nkeys),
atomic_read(&user->nikeys),
user->qnkeys,