+ kernel-userc-clean-up-some-leftover-code.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: kernel/user.c: clean up some leftover code
has been added to the -mm tree.  Its filename is
     kernel-userc-clean-up-some-leftover-code.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/kernel-userc-clean-up-some-leftover-code.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/kernel-userc-clean-up-some-leftover-code.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Subject: kernel/user.c: clean up some leftover code

The out_unlock label is misleading; no unlocking happens after it, so just
return NULL directly.  Also, nothing between the kmem_cache_zalloc() that
creates new and the two key_put() can initialize new->uid_keyring or
new->session_keyring, so those calls are no-ops.

Link: http://lkml.kernel.org/r/20190424200404.9114-1-linux@xxxxxxxxxxxxxxxxxx
Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 kernel/user.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

--- a/kernel/user.c~kernel-userc-clean-up-some-leftover-code
+++ a/kernel/user.c
@@ -185,7 +185,7 @@ struct user_struct *alloc_uid(kuid_t uid
 	if (!up) {
 		new = kmem_cache_zalloc(uid_cachep, GFP_KERNEL);
 		if (!new)
-			goto out_unlock;
+			return NULL;
 
 		new->uid = uid;
 		refcount_set(&new->__count, 1);
@@ -199,8 +199,6 @@ struct user_struct *alloc_uid(kuid_t uid
 		spin_lock_irq(&uidhash_lock);
 		up = uid_hash_find(uid, hashent);
 		if (up) {
-			key_put(new->uid_keyring);
-			key_put(new->session_keyring);
 			kmem_cache_free(uid_cachep, new);
 		} else {
 			uid_hash_insert(new, hashent);
@@ -210,9 +208,6 @@ struct user_struct *alloc_uid(kuid_t uid
 	}
 
 	return up;
-
-out_unlock:
-	return NULL;
 }
 
 static int __init uid_cache_init(void)
_

Patches currently in -mm which might be from linux@xxxxxxxxxxxxxxxxxx are

kernel-userc-clean-up-some-leftover-code.patch
lib-bitmapc-remove-unused-export_symbols.patch
lib-bitmapc-guard-exotic-bitmap-functions-by-config_numa.patch
bitopsh-sanitize-rotate-primitives.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux