[patch] slob: fix memory corruption

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Nick Piggin <nickpiggin@...>
Cc: David Miller <davem@...>, <mpm@...>, <rjw@...>, <linux-kernel@...>, <akpm@...>, <torvalds@...>, Thomas Gleixner <tglx@...>
Date: Thursday, November 15, 2007 - 7:32 am

* Ingo Molnar <mingo@elte.hu> wrote:


that did the trick! Nick, find an updated patch below. (reference to the 
bugzilla added.)

	Ingo

-------------------->
Subject: slob: fix memory corruption
From: Nick Piggin <npiggin@suse.de>

Previously, it would be possible for prev->next to point to
&free_slob_pages, and thus we would try to move a list onto itself, and
bad things would happen.

It seems a bit hairy to be doing list operations with the list marker as
an entry, rather than a head, but...

this resolves the following crash:

  http://bugzilla.kernel.org/show_bug.cgi?id=9379

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 mm/slob.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux/mm/slob.c
===================================================================
--- linux.orig/mm/slob.c
+++ linux/mm/slob.c
@@ -321,7 +321,8 @@ static void *slob_alloc(size_t size, gfp
 		/* Improve fragment distribution and reduce our average
 		 * search time by starting our next search here. (see
 		 * Knuth vol 1, sec 2.5, pg 449) */
-		if (free_slob_pages.next != prev->next)
+		if (prev != free_slob_pages.prev &&
+				free_slob_pages.next != prev->next)
 			list_move_tail(&free_slob_pages, prev->next);
 		break;
 	}
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.24-rc2: Reported regressions from 2.6.23 (updated), Rafael J. Wysocki, (Sun Nov 11, 3:58 pm)
[bug] SLOB crash, 2.6.24-rc2, Ingo Molnar, (Wed Nov 14, 7:20 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Matt Mackall, (Wed Nov 14, 1:36 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, Matt Mackall, (Wed Nov 14, 2:39 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, Ingo Molnar, (Wed Nov 14, 3:05 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, David Miller, (Wed Nov 14, 6:39 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, Matt Mackall, (Wed Nov 14, 6:53 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, David Miller, (Wed Nov 14, 7:10 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, Matt Mackall, (Wed Nov 14, 7:37 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, David Miller, (Wed Nov 14, 7:41 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, Ingo Molnar, (Thu Nov 15, 6:43 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Nick Piggin, (Thu Nov 15, 6:57 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Ingo Molnar, (Thu Nov 15, 7:28 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Dave Haywood, (Thu Nov 15, 8:18 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Nick Piggin, (Thu Nov 15, 7:39 am)
[patch] slob: fix memory corruption, Ingo Molnar, (Thu Nov 15, 7:32 am)
Re: [patch] slob: fix memory corruption, Matt Mackall, (Thu Nov 15, 12:00 pm)
Re: [patch] slob: fix memory corruption, Ingo Molnar, (Thu Nov 15, 8:48 am)
Re: [patch] slob: fix memory corruption, Nick Piggin, (Thu Nov 15, 4:25 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, David Miller, (Thu Nov 15, 6:51 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Ingo Molnar, (Thu Nov 15, 7:03 am)
Re: [bug] SLOB crash, 2.6.24-rc2, David Miller, (Thu Nov 15, 7:05 am)
Re: [bug] SLOB crash, 2.6.24-rc2, Matt Mackall, (Wed Nov 14, 8:09 pm)
Re: [bug] SLOB crash, 2.6.24-rc2, Matt Mackall, (Wed Nov 14, 3:42 pm)
Re: 2.6.24-rc2: Reported regressions from 2.6.23 (updated), Francois Romieu, (Sun Nov 11, 4:33 pm)
Re: 2.6.24-rc2: Reported regressions from 2.6.23 (updated), Bartlomiej Zolnierkiewicz..., (Sun Nov 11, 6:22 pm)
Re: 2.6.24-rc2: Reported regressions from 2.6.23 (updated), Thomas Lindroth, (Tue Nov 13, 10:09 am)
Re: 2.6.24-rc2: Reported regressions from 2.6.23 (updated), Rafael J. Wysocki, (Sun Nov 11, 4:34 pm)