cgroup: initialize xattr before calling d_instantiate()
authorLi Zefan <lizefan@huawei.com>
Tue, 14 May 2013 11:44:20 +0000 (19:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Jun 2013 19:53:05 +0000 (12:53 -0700)
commit24622f8bb1d75e005f6cd1ccaea82b72e31b6d6c
tree39dc535b002650b3c959e15a219cc6c494d44d98
parent52f36be0f4e2fafa5dd85fbd6508bbfba314fd58
cgroup: initialize xattr before calling d_instantiate()

commit d6cbf35dac8a3dadb9103379820c96d7c85df3d9 upstream.

cgroup_create_file() calls d_instantiate(), which may decide to look
at the xattrs on the file. Smack always does this and SELinux can be
configured to do so.

But cgroup_add_file() didn't initialize xattrs before calling
cgroup_create_file(), which finally leads to dereferencing NULL
dentry->d_fsdata.

This bug has been there since cgroup xattr was introduced.

Reported-by: Ivan Bulatovic <combuster@archlinux.us>
Reported-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/cgroup.c