All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Menage <menage@google.com>,
	Al Viro <viro@ZenIV.linux.org.uk>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Containers <containers@lists.linux-foundation.org>
Subject: [PATCH] cgroups: fix possible use after free
Date: Tue, 10 Feb 2009 17:31:39 +0800	[thread overview]
Message-ID: <4991497B.4030200@cn.fujitsu.com> (raw)

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

             reply	other threads:[~2009-02-10  9:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10  9:31 Li Zefan [this message]
2009-02-10 10:15 ` [PATCH] cgroups: fix possible use after free 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
2009-02-11  1:54               ` Paul Menage
     [not found]               ` <20090211011933.GB28946-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
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
  -- strict thread matches above, loose matches on Subject: below --
2009-02-10  9:31 Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4991497B.4030200@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.