Merge branch 'modules-next' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty...
[sfrench/cifs-2.6.git] / security / keys / keyring.c
index f04d8cf81f3c77cc17f2646059986735740d754c..6e42df15a24c3b3509455d8afedaed3dccf66662 100644 (file)
@@ -256,7 +256,7 @@ error:
 /*
  * Allocate a keyring and link into the destination keyring.
  */
-struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
+struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
                          const struct cred *cred, unsigned long flags,
                          struct key *dest)
 {
@@ -612,7 +612,7 @@ 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())
+                       if (!kuid_has_mapping(current_user_ns(), keyring->user->uid))
                                continue;
 
                        if (test_bit(KEY_FLAG_REVOKED, &keyring->flags))