[PATCH 04/13] security/selinux: check for LOOKUP_RCU in _follow_link.

From: NeilBrown
Date: Mon Mar 16 2015 - 00:47:19 EST


Some of dentry_has_perm() is not rcu-safe, so if LOOKUP_RCU
is set in selinux_inode_follow_link(), give up with
-ECHILD.

It is possible that dentry_has_perm could sometimes complete
in RCU more, in which case the flag could be propagated further
down the stack...

Signed-off-by: NeilBrown <neilb@xxxxxxx>
---
security/selinux/hooks.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e3074e01f058..5d4de8cbfaa6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2866,6 +2866,8 @@ static int selinux_inode_follow_link(struct dentry *dentry, int flags)
{
const struct cred *cred = current_cred();

+ if (flags & LOOKUP_RCU)
+ return -ECHILD;
return dentry_has_perm(cred, dentry, FILE__READ);
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/