From: Stephen Smalley Date: Fri, 25 Jan 2008 18:03:42 +0000 (-0500) Subject: selinux: fix labeling of /proc/net inodes X-Git-Tag: v2.6.24.1~8 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9a87ea3ee51fb81e7a33b820a8bb59d23c7be9ef;p=karo-tx-linux.git selinux: fix labeling of /proc/net inodes patch b1aa5301b9f88a4891061650c591fb8fe1c1d1da in mainline. The proc net rewrite had a side effect on selinux, leading it to mislabel the /proc/net inodes, thereby leading to incorrect denials. Fix security_genfs_sid to ignore extra leading / characters in the path supplied by selinux_proc_get_sid since we now get "//net/..." rather than "/net/...". Signed-off-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Greg Kroah-Hartman --- diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index f83b19daed16..4bf715d4cf29 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -1744,6 +1744,9 @@ int security_genfs_sid(const char *fstype, struct ocontext *c; int rc = 0, cmp = 0; + while (path[0] == '/' && path[1] == '/') + path++; + POLICY_RDLOCK; for (genfs = policydb.genfs; genfs; genfs = genfs->next) {