summaryrefslogtreecommitdiff
path: root/security/tomoyo/realpath.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-10-06 17:26:56 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-10-06 17:26:56 -0700
commit1586a7036d3f0e7dd29a3090b9dfa4eb2c15f12c (patch)
tree97d54c401c2fba6807ed3ea9f60a2c2d8ef5ccac /security/tomoyo/realpath.c
parentab296221579715fb8f36a27c374ebabe5bfb7e9e (diff)
parent467cf8ef88d3124c189e2ff4726fe5247a88fe46 (diff)
Merge tag 'pull-tomoyo' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc tomoyo changes from Al Viro: "A couple of assorted tomoyo patches" * tag 'pull-tomoyo' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: tomoyo: struct path it might get from LSM callers won't have NULL dentry or mnt tomoyo: use vsnprintf() properly
Diffstat (limited to 'security/tomoyo/realpath.c')
-rw-r--r--security/tomoyo/realpath.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index df4798980416..1c483ee7f93d 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -240,11 +240,8 @@ char *tomoyo_realpath_from_path(const struct path *path)
char *name = NULL;
unsigned int buf_len = PAGE_SIZE / 2;
struct dentry *dentry = path->dentry;
- struct super_block *sb;
+ struct super_block *sb = dentry->d_sb;
- if (!dentry)
- return NULL;
- sb = dentry->d_sb;
while (1) {
char *pos;
struct inode *inode;
@@ -264,10 +261,8 @@ char *tomoyo_realpath_from_path(const struct path *path)
inode = d_backing_inode(sb->s_root);
/*
* Get local name for filesystems without rename() operation
- * or dentry without vfsmount.
*/
- if (!path->mnt ||
- (!inode->i_op->rename &&
+ if ((!inode->i_op->rename &&
!(sb->s_type->fs_flags & FS_REQUIRES_DEV)))
pos = tomoyo_get_local_path(path->dentry, buf,
buf_len - 1);