diff options
author | Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> | 2009-12-09 01:36:04 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-12-09 03:01:16 -0500 |
commit | 67fa4880c5e059428392ca6f7c2f9c38e8546fea (patch) | |
tree | e9dd72bf71067fcacb122b7ced20d964e3be0be8 | |
parent | 1ad1f10cd915744bbe52b19423653b38287d827d (diff) |
TOMOYO: Compare filesystem by magic number rather than by name.
Please apply below one after merging 1557d33007f63dd96e5d15f33af389378e5f2e54
(Merge git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl-2.6).
----------
[PATCH for 2.6.33] TOMOYO: Compare filesystem by magic number rather than by name.
We can use magic number for checking whether the filesystem is procfs or not.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
-rw-r--r-- | security/tomoyo/realpath.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 18369d497eb8..e3c7aa0fb706 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/mnt_namespace.h> | 14 | #include <linux/mnt_namespace.h> |
15 | #include <linux/fs_struct.h> | 15 | #include <linux/fs_struct.h> |
16 | #include <linux/hash.h> | 16 | #include <linux/hash.h> |
17 | #include <linux/magic.h> | ||
17 | 18 | ||
18 | #include "common.h" | 19 | #include "common.h" |
19 | #include "realpath.h" | 20 | #include "realpath.h" |
@@ -112,7 +113,7 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname, | |||
112 | path_put(&ns_root); | 113 | path_put(&ns_root); |
113 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ | 114 | /* Prepend "/proc" prefix if using internal proc vfs mount. */ |
114 | if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && | 115 | if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && |
115 | (strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { | 116 | (path->mnt->mnt_sb->s_magic == PROC_SUPER_MAGIC)) { |
116 | sp -= 5; | 117 | sp -= 5; |
117 | if (sp >= newname) | 118 | if (sp >= newname) |
118 | memcpy(sp, "/proc", 5); | 119 | memcpy(sp, "/proc", 5); |