From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: Aristeu Rozanski <aris@redhat.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: cgroup.h:566 suspicious rcu_dereference_check() usage!
Date: Mon, 8 Oct 2012 12:52:07 -0700 [thread overview]
Message-ID: <20121008195207.GG2453@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121006131607.GA12798@localhost>
On Sat, Oct 06, 2012 at 09:16:07PM +0800, Fengguang Wu wrote:
> Hi Aristeu,
>
> I got the below warning in linus/master and linux-next, and it's
> bisected down to:
Cristian Rodríguez reported what looks like the same bug. Does the
patch below fix it?
Thanx, Paul
------------------------------------------------------------------------
device_cgroup: Restore rcu_read_lock() protection to devcgroup_inode_mknod()
Commit ad676077 (device_cgroup: convert device_cgroup internally to
policy + exceptions) restructured devcgroup_inode_mknod(), removing
rcu_read_lock() in the process. However, RCU read-side protection
is required by the call to task_devcgroup(), so this commit restores
the rcu_read_lock() and rcu_read_unlock().
Reported-by: Cristian Rodríguez <crrodriguez@opensuse.org>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 44dfc41..c686110 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -576,9 +576,12 @@ int __devcgroup_inode_permission(struct inode *inode, int mask)
int devcgroup_inode_mknod(int mode, dev_t dev)
{
- struct dev_cgroup *dev_cgroup = task_devcgroup(current);
+ struct dev_cgroup *dev_cgroup;
+ int ret;
short type;
+ rcu_read_lock();
+ dev_cgroup = task_devcgroup(current);
if (!S_ISBLK(mode) && !S_ISCHR(mode))
return 0;
@@ -587,7 +590,9 @@ int devcgroup_inode_mknod(int mode, dev_t dev)
else
type = DEV_CHAR;
- return __devcgroup_check_permission(dev_cgroup, type, MAJOR(dev),
+ ret = __devcgroup_check_permission(dev_cgroup, type, MAJOR(dev),
MINOR(dev), ACC_MKNOD);
+ rcu_read_unlock();
+ return ret;
}
prev parent reply other threads:[~2012-10-08 19:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-06 13:16 cgroup.h:566 suspicious rcu_dereference_check() usage! Fengguang Wu
2012-10-08 19:52 ` Paul E. McKenney [this message]
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=20121008195207.GG2453@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=aris@redhat.com \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox