mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [folded-merged] stackdepot-check-depot_index-before-accessing-the-stack-slab-fix.patch removed from -mm tree
@ 2020-04-07  1:49 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-04-07  1:49 UTC (permalink / raw)
  To: dan.carpenter, glider, mm-commits


The patch titled
     Subject: lib/stackdepot.c: fix a condition in stack_depot_fetch()
has been removed from the -mm tree.  Its filename was
     stackdepot-check-depot_index-before-accessing-the-stack-slab-fix.patch

This patch was dropped because it was folded into stackdepot-check-depot_index-before-accessing-the-stack-slab.patch

------------------------------------------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
Subject: lib/stackdepot.c: fix a condition in stack_depot_fetch()

We should check for a NULL pointer first before adding the offset. 
Otherwise if the pointer is NULL and the offset is non-zero, it will lead
to an Oops.

Link: http://lkml.kernel.org/r/20200312113006.GA20562@mwanda
Fixes: d45048e65a59 ("lib/stackdepot.c: check depot_index before accessing the stack slab")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/stackdepot.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/lib/stackdepot.c~stackdepot-check-depot_index-before-accessing-the-stack-slab-fix
+++ a/lib/stackdepot.c
@@ -206,18 +206,16 @@ unsigned int stack_depot_fetch(depot_sta
 	size_t offset = parts.offset << STACK_ALLOC_ALIGN;
 	struct stack_record *stack;
 
+	*entries = NULL;
 	if (parts.slabindex > depot_index) {
 		WARN(1, "slab index %d out of bounds (%d) for stack id %08x\n",
 			parts.slabindex, depot_index, handle);
-		*entries = NULL;
 		return 0;
 	}
 	slab = stack_slabs[parts.slabindex];
-	stack = slab + offset;
-	if (!stack) {
-		*entries = NULL;
+	if (!slab)
 		return 0;
-	}
+	stack = slab + offset;
 
 	*entries = stack->entries;
 	return stack->size;
_

Patches currently in -mm which might be from dan.carpenter@oracle.com are

stackdepot-check-depot_index-before-accessing-the-stack-slab.patch
lib-test_kmod-remove-a-null-test.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-07  1:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07  1:49 [folded-merged] stackdepot-check-depot_index-before-accessing-the-stack-slab-fix.patch removed from -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).