From: Li Zhong <zhong@linux.vnet.ibm.com>
To: linux-next list <linux-next@vger.kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>
Subject: [RFC PATCH next]cgroup: use css_get() in cgroup_create() to check CSS_ROOT
Date: Fri, 16 Aug 2013 17:57:14 +0800 [thread overview]
Message-ID: <1376647034.2642.22.camel@ThinkPad-T5421> (raw)
It seems that the root css doesn't have refcnt allocated(not needed?),
and would cause the booting error attached.
This patch tries to use css_get() to not increase the refcnt if parent
is root.
[ 0.792038] BUG: unable to handle kernel NULL pointer dereference at (null)
[ 0.792937] IP: [<ffffffff810b37cc>] cgroup_mkdir+0x37c/0x740
[ 0.793027] PGD 0
[ 0.793027] Oops: 0002 [#1]
[ 0.793027] Modules linked in:
[ 0.793027] CPU: 0 PID: 1 Comm: systemd Not tainted 3.11.0-rc5-next-20130815+ #1
[ 0.793027] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
[ 0.793027] task: ffff88007f868000 ti: ffff88007f864000 task.ti: ffff88007f864000
[ 0.793027] RIP: 0010:[<ffffffff810b37cc>] [<ffffffff810b37cc>] cgroup_mkdir+0x37c/0x740
[ 0.793027] RSP: 0018:ffff88007f865df8 EFLAGS: 00010246
[ 0.793027] RAX: 0000000000000000 RBX: ffffffff81a46ee0 RCX: 0000000000000001
[ 0.793027] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81a415c0
[ 0.793027] RBP: ffff88007f865ec8 R08: 0000000000000001 R09: 0000000000000000
[ 0.793027] R10: ffff88007ce6d060 R11: 0000000000000000 R12: ffff88007ce6d000
[ 0.793027] R13: ffff88007ce6d060 R14: ffffffff81a46d80 R15: ffff88007c6e8018
[ 0.793027] FS: 00007f13dbf6f840(0000) GS:ffffffff81a23000(0000) knlGS:0000000000000000
[ 0.793027] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 0.793027] CR2: 0000000000000000 CR3: 000000007b7e5000 CR4: 00000000000006b0
[ 0.793027] Stack:
[ 0.793027] ffffffff810b380d 0000000000000002 ffff88007f865e18 ffffffff81167069
[ 0.793027] ffff88007f865ed8 ffffffff8116a3f5 ffff880037454400 ffff88007c6e8018
[ 0.793027] ffff88007c6e8028 ffff88007c6e8328 ffff88007c6e8000 ffff88007ce6d000
[ 0.793027] Call Trace:
[ 0.793027] [<ffffffff810b380d>] ? cgroup_mkdir+0x3bd/0x740
[ 0.793027] [<ffffffff81167069>] ? lookup_hash+0x19/0x20
[ 0.793027] [<ffffffff8116a3f5>] ? kern_path_create+0x95/0x170
[ 0.793027] [<ffffffff8116ce3e>] vfs_mkdir+0x9e/0xf0
[ 0.793027] [<ffffffff8116d7a0>] SyS_mkdirat+0x60/0xe0
[ 0.793027] [<ffffffff8116d839>] SyS_mkdir+0x19/0x20
[ 0.793027] [<ffffffff814c960d>] tracesys+0xcf/0xd4
[ 0.793027] Code: ad 70 ff ff ff 48 89 9d 60 ff ff ff 4d 89 d5 4c 8b bd 68 ff ff ff 4c 8b 65 88 eb 50 0f 1f 00 48 8b 43 18 a8 03 0f 85 6c 03 00 00 <ff> 00 e8 1d 0a fb ff 85 c0 74 0d 80 3d f0 45 a1 00 00 0f 84 4c
[ 0.793027] RIP [<ffffffff810b37cc>] cgroup_mkdir+0x37c/0x740
[ 0.793027] RSP <ffff88007f865df8>
[ 0.793027] CR2: 0000000000000000
[ 0.827296] ---[ end trace a4b14b49bc46fd60 ]---
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
kernel/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 723194f..781f8cd 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4485,7 +4485,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
struct cgroup_subsys_state *css = css_ar[ss->subsys_id];
dget(dentry);
- percpu_ref_get(&css->parent->refcnt);
+ css_get(css->parent);
}
/* hold a ref to the parent's dentry */
next reply other threads:[~2013-08-16 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-16 9:57 Li Zhong [this message]
2013-08-16 10:16 ` [RFC PATCH next]cgroup: use css_get() in cgroup_create() to check CSS_ROOT Li Zefan
2013-08-16 14:58 ` Tejun Heo
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=1376647034.2642.22.camel@ThinkPad-T5421 \
--to=zhong@linux.vnet.ibm.com \
--cc=linux-next@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=tj@kernel.org \
/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.