All of lore.kernel.org
 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
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ 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 related	[flat|nested] 14+ messages in thread
* [PATCH] cgroups: fix possible use after free
@ 2009-02-10  9:31 Li Zefan
  0 siblings, 0 replies; 14+ messages in thread
From: Li Zefan @ 2009-02-10  9:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Containers, Paul Menage, Al Viro, LKML

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-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
Signed-off-by: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
 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 related	[flat|nested] 14+ messages in thread

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

Thread overview: 14+ 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
     [not found]   ` <6599ad830902100215o185edd31k8731e033717dbb49-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-10 12:45     ` Al Viro
2009-02-10 12:45       ` Al Viro
     [not found]       ` <20090210124527.GA28946-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2009-02-11  0:01         ` Paul Menage
2009-02-11  0:01           ` Paul Menage
     [not found]           ` <6599ad830902101601i294ffaa5xd01611c5121a5685-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-11  1:19             ` Al Viro
2009-02-11  1:19               ` Al Viro
     [not found]               ` <20090211011933.GB28946-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2009-02-11  1:54                 ` Paul Menage
2009-02-11  1:54               ` Paul Menage
     [not found] ` <4991497B.4030200-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-02-10 10:15   ` Paul Menage
2009-02-11  0:01   ` Paul Menage
2009-02-11  0:01 ` Paul Menage
2009-02-10  9:31 Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.