diff options
author | Li Zhong <zhong@linux.vnet.ibm.com> | 2013-08-16 17:57:14 +0800 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-08-16 10:55:31 -0400 |
commit | 930913a31289202d232186b82854b26d7fb7cf4d (patch) | |
tree | 48c8ae45f0d613ac6ebd454d24b2241dd8dbb067 /kernel/cgroup.c | |
parent | ff58ac0d58d51bffe868b239ed8fce7c4a23c5a9 (diff) | |
download | linux-930913a31289202d232186b82854b26d7fb7cf4d.tar.gz linux-930913a31289202d232186b82854b26d7fb7cf4d.tar.bz2 linux-930913a31289202d232186b82854b26d7fb7cf4d.zip |
cgroup: use css_get() in cgroup_create() to check CSS_ROOT
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.
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffff810b37cc>] cgroup_mkdir+0x37c/0x740
PGD 0
Oops: 0002 [#1]
Modules linked in:
CPU: 0 PID: 1 Comm: systemd Not tainted 3.11.0-rc5-next-20130815+ #1
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
task: ffff88007f868000 ti: ffff88007f864000 task.ti: ffff88007f864000
RIP: 0010:[<ffffffff810b37cc>] [<ffffffff810b37cc>] cgroup_mkdir+0x37c/0x740
RSP: 0018:ffff88007f865df8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffffff81a46ee0 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff81a415c0
RBP: ffff88007f865ec8 R08: 0000000000000001 R09: 0000000000000000
R10: ffff88007ce6d060 R11: 0000000000000000 R12: ffff88007ce6d000
R13: ffff88007ce6d060 R14: ffffffff81a46d80 R15: ffff88007c6e8018
FS: 00007f13dbf6f840(0000) GS:ffffffff81a23000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000007b7e5000 CR4: 00000000000006b0
Stack:
ffffffff810b380d 0000000000000002 ffff88007f865e18 ffffffff81167069
ffff88007f865ed8 ffffffff8116a3f5 ffff880037454400 ffff88007c6e8018
ffff88007c6e8028 ffff88007c6e8328 ffff88007c6e8000 ffff88007ce6d000
Call Trace:
[<ffffffff810b380d>] ? cgroup_mkdir+0x3bd/0x740
[<ffffffff81167069>] ? lookup_hash+0x19/0x20
[<ffffffff8116a3f5>] ? kern_path_create+0x95/0x170
[<ffffffff8116ce3e>] vfs_mkdir+0x9e/0xf0
[<ffffffff8116d7a0>] SyS_mkdirat+0x60/0xe0
[<ffffffff8116d839>] SyS_mkdir+0x19/0x20
[<ffffffff814c960d>] tracesys+0xcf/0xd4
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
RIP [<ffffffff810b37cc>] cgroup_mkdir+0x37c/0x740
RSP <ffff88007f865df8>
CR2: 0000000000000000
---[ end trace a4b14b49bc46fd60 ]---
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 66d01078eebe..b69b572131e5 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4494,7 +4494,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 */ |