[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0911032215290.29276@sister.anvils>
Date: Tue, 3 Nov 2009 22:19:43 +0000 (GMT)
From: Hugh Dickins <hugh.dickins@...cali.co.uk>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Jiri Slaby <jirislaby@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Rik van Riel <riel@...hat.com>
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@...cali.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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists