apparmor/kernel-patches/for-mainline/unreachabe-paths.diff

23 lines
632 B
Diff
Raw Normal View History

2007-02-22 04:45:15 +00:00
There is no need to go throught the whole state machine for unreachable
dentries; they will never match.
Index: b/security/apparmor/main.c
===================================================================
--- a/security/apparmor/main.c
+++ b/security/apparmor/main.c
@@ -172,6 +172,14 @@ static char *aa_get_name(struct dentry *
2007-02-22 04:45:15 +00:00
name = d_namespace_path(dentry, mnt, buf, size);
2007-02-22 04:45:15 +00:00
if (!IS_ERR(name)) {
+ if (name[0] != '/') {
2007-02-22 04:45:15 +00:00
+ /*
+ * This dentry is not connected to the
+ * namespace root -- reject access.
+ */
+ kfree(buf);
+ return ERR_PTR(-ENOENT);
+ }
*buffer = buf;
return name;
}