[to-be-updated] mm-mempolicy-fix-exception-handling-in-shared_policy_replace.patch removed from -mm tree

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

 



The quilt patch titled
     Subject: mm/mempolicy: fix exception handling in shared_policy_replace()
has been removed from the -mm tree.  Its filename was
     mm-mempolicy-fix-exception-handling-in-shared_policy_replace.patch

This patch was dropped because an updated version will be merged

------------------------------------------------------
From: Markus Elfring <Markus.Elfring@xxxxxx>
Subject: mm/mempolicy: fix exception handling in shared_policy_replace()
Date: Thu, 23 Mar 2023 18:30:48 +0100

The label â??err_outâ?? was used to jump to another pointer check despite of
the detail in the implementation of the function â??shared_policy_replaceâ??
that it was determined already that a corresponding variable contained a
null pointer because of a failed call of the function â??kmem_cache_allocâ??.

1. Use more appropriate labels instead.

2. The implementation of the function â??mpol_putâ?? contains a pointer check
   for its single input parameter.
   Thus delete a redundant check in the caller.


This issue was detected by using the Coccinelle software.

Fixes: 42288fe366c4f1ce7522bc9f27d0bc2a81c55264 ("mm: mempolicy: Convert shared_policy mutex to spinlock")
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/mempolicy.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- a/mm/mempolicy.c~mm-mempolicy-fix-exception-handling-in-shared_policy_replace
+++ a/mm/mempolicy.c
@@ -2736,13 +2736,12 @@ restart:
 		sp_insert(sp, new);
 	write_unlock(&sp->lock);
 	ret = 0;
+put_mpol:
+	mpol_put(mpol_new);
 
-err_out:
-	if (mpol_new)
-		mpol_put(mpol_new);
 	if (n_new)
 		kmem_cache_free(sn_cache, n_new);
-
+exit:
 	return ret;
 
 alloc_new:
@@ -2750,10 +2749,10 @@ alloc_new:
 	ret = -ENOMEM;
 	n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL);
 	if (!n_new)
-		goto err_out;
+		goto exit;
 	mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL);
 	if (!mpol_new)
-		goto err_out;
+		goto put_mpol;
 	atomic_set(&mpol_new->refcnt, 1);
 	goto restart;
 }
_

Patches currently in -mm which might be from Markus.Elfring@xxxxxx are





[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