From: Li Zefan <lizefan@huawei.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: tj@kernel.org, containers@lists.linux-foundation.org,
cgroups@vger.kernel.org, lkml@vger.kernel.org,
LSM <linux-security-module@vger.kernel.org>
Subject: Re: cgroup dentry insufficiently initialized prior to calling d_instantiate.
Date: Tue, 14 May 2013 18:47:23 +0800 [thread overview]
Message-ID: <5192163B.9010208@huawei.com> (raw)
In-Reply-To: <518D6E7C.9050204@schaufler-ca.com>
On 2013/5/11 6:02, Casey Schaufler wrote:
>
> In kernel/cgroup.c in cgroup_add_file() we have:
>
>
> dentry = lookup_one_len(name, dir, strlen(name));
> if (IS_ERR(dentry)) {
> error = PTR_ERR(dentry);
> goto out;
> }
>
> mode = cgroup_file_mode(cft);
> error = cgroup_create_file(dentry, mode | S_IFREG, cgrp->root->sb);
> if (!error) {
> cfe->type = (void *)cft;
> cfe->dentry = dentry;
> dentry->d_fsdata = cfe;
> simple_xattrs_init(&cfe->xattrs);
> list_add_tail(&cfe->node, &parent->files);
> cfe = NULL;
> }
> dput(dentry);
>
> 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, although
> no one seems to be using that option. Since the dentry
> has not been initialized panics in __d_xattr ensue. See
> bugzilla 57791.
>
cgroup_add_file() should initialize xattrs before calling d_instantiate(),
just like cgroup_create() does.
I'll prepare a patch to fix it. Thanks for the report!
next prev parent reply other threads:[~2013-05-14 10:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-10 22:02 cgroup dentry insufficiently initialized prior to calling d_instantiate Casey Schaufler
2013-05-14 10:47 ` Li Zefan [this message]
[not found] ` <518D6E7C.9050204-iSGtlc1asvQWG2LlvL+J4A@public.gmane.org>
2013-05-14 10:47 ` 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=5192163B.9010208@huawei.com \
--to=lizefan@huawei.com \
--cc=casey@schaufler-ca.com \
--cc=cgroups@vger.kernel.org \
--cc=containers@lists.linux-foundation.org \
--cc=linux-security-module@vger.kernel.org \
--cc=lkml@vger.kernel.org \
--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.