Commit 67fa4880 authored by Tetsuo Handa's avatar Tetsuo Handa Committed by James Morris

TOMOYO: Compare filesystem by magic number rather than by name.

Please apply below one after merging 1557d330
(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: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 1ad1f10c
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/mnt_namespace.h> #include <linux/mnt_namespace.h>
#include <linux/fs_struct.h> #include <linux/fs_struct.h>
#include <linux/hash.h> #include <linux/hash.h>
#include <linux/magic.h>
#include "common.h" #include "common.h"
#include "realpath.h" #include "realpath.h"
...@@ -112,7 +113,7 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname, ...@@ -112,7 +113,7 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname,
path_put(&ns_root); path_put(&ns_root);
/* Prepend "/proc" prefix if using internal proc vfs mount. */ /* Prepend "/proc" prefix if using internal proc vfs mount. */
if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) && if (!IS_ERR(sp) && (path->mnt->mnt_parent == path->mnt) &&
(strcmp(path->mnt->mnt_sb->s_type->name, "proc") == 0)) { (path->mnt->mnt_sb->s_magic == PROC_SUPER_MAGIC)) {
sp -= 5; sp -= 5;
if (sp >= newname) if (sp >= newname)
memcpy(sp, "/proc", 5); memcpy(sp, "/proc", 5);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment