keys: skip keys from another user namespace

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:01 pm

Gitweb:     http://git.kernel.org/linus/2ea190d0a006ce5218baa6e798512652446a605a
Commit:     2ea190d0a006ce5218baa6e798512652446a605a
Parent:     8ff3bc3138a400294ee9e126ac75fc9a9fae4e0b
Author:     Serge E. Hallyn <serue@us.ibm.com>
AuthorDate: Thu Feb 26 18:27:55 2009 -0600
Committer:  James Morris <jmorris@namei.org>
CommitDate: Fri Feb 27 12:35:12 2009 +1100

    keys: skip keys from another user namespace
    
    When listing keys, do not return keys belonging to the
    same uid in another user namespace.  Otherwise uid 500
    in another user namespace will return keyrings called
    uid.500 for another user namespace.
    
    Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
    Acked-by: David Howells <dhowells@redhat.com>
    Signed-off-by: James Morris <jmorris@namei.org>
---
 security/keys/keyring.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index ed85157..3dba81c 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -539,6 +539,9 @@ struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
 				    &keyring_name_hash[bucket],
 				    type_data.link
 				    ) {
+			if (keyring->user->user_ns != current_user_ns())
+				continue;
+
 			if (test_bit(KEY_FLAG_REVOKED, &keyring->flags))
 				continue;
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
keys: skip keys from another user namespace, Linux Kernel Mailing ..., (Thu Mar 26, 12:01 pm)