mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cgroups: fix possible use after free
@ 2009-02-10  9:31 Li Zefan
  2009-02-10 10:15 ` Paul Menage
  2009-02-11  0:01 ` Paul Menage
  0 siblings, 2 replies; 7+ messages in thread
From: Li Zefan @ 2009-02-10  9:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Paul Menage, Al Viro, LKML, Linux Containers

In cgroup_kill_sb(), root is freed before sb is detached from the list,
so another sget() may find this sb and call cgroup_test_super(),
which will access the root that has been freed.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 kernel/cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5a54ff4..42fd3f2 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1122,8 +1122,8 @@ static void cgroup_kill_sb(struct super_block *sb) {
 
 	mutex_unlock(&cgroup_mutex);
 
-	kfree(root);
 	kill_litter_super(sb);
+	kfree(root);
 }
 
 static struct file_system_type cgroup_fs_type = {
-- 
1.5.4.rc3

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-02-11  1:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-10  9:31 [PATCH] cgroups: fix possible use after free Li Zefan
2009-02-10 10:15 ` Paul Menage
2009-02-10 12:45   ` Al Viro
2009-02-11  0:01     ` Paul Menage
2009-02-11  1:19       ` Al Viro
2009-02-11  1:54         ` Paul Menage
2009-02-11  0:01 ` Paul Menage

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®