lkml.org 
[lkml]   [2009]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH mmotm] fix to swap_info-include-first_swap_extent-fix.patch
Sorry, just noticed what the diff contexts don't show: Jiri's patch
is initializing p->first_swap_extent.list at a point before p has
been decided - we may kfree that newly allocated p and go on to
reuse an existing free entry for p.

Now, the patch is not actually wrong: an existing free entry will have
a good empty first_swap_extent.list; but it looks suspicious, it seems
strange to initialize a field in something we're about to kfree, and
I'd rather we put that initialization back to where it was in 2.6.32.

Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
---

mm/swapfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- mmotm/mm/swapfile.c 2009-11-03 18:05:36.000000000 +0000
+++ linux/mm/swapfile.c 2009-11-03 18:08:26.000000000 +0000
@@ -1768,7 +1768,6 @@ SYSCALL_DEFINE2(swapon, const char __use
kfree(p);
goto out;
}
- INIT_LIST_HEAD(&p->first_swap_extent.list);
if (type >= nr_swapfiles) {
p->type = type;
swap_info[type] = p;
@@ -1787,6 +1786,7 @@ SYSCALL_DEFINE2(swapon, const char __use
* would be relying on p->type to remain valid.
*/
}
+ INIT_LIST_HEAD(&p->first_swap_extent.list);
p->flags = SWP_USED;
p->next = -1;
spin_unlock(&swap_lock);

\
 
 \ /
  Last update: 2009-11-03 23:23    [W:0.113 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site