Skip to content

Commit 467cf8e

Browse files
author
Al Viro
committed
tomoyo: struct path it might get from LSM callers won't have NULL dentry or mnt
Acked-by: Tetsuo Handa <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 8986877 commit 467cf8e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

security/tomoyo/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ int tomoyo_path_number_perm(const u8 type, const struct path *path,
717717
int idx;
718718

719719
if (tomoyo_init_request_info(&r, NULL, tomoyo_pn2mac[type])
720-
== TOMOYO_CONFIG_DISABLED || !path->dentry)
720+
== TOMOYO_CONFIG_DISABLED)
721721
return 0;
722722
idx = tomoyo_read_lock();
723723
if (!tomoyo_get_realpath(&buf, path))

security/tomoyo/realpath.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,8 @@ char *tomoyo_realpath_from_path(const struct path *path)
240240
char *name = NULL;
241241
unsigned int buf_len = PAGE_SIZE / 2;
242242
struct dentry *dentry = path->dentry;
243-
struct super_block *sb;
243+
struct super_block *sb = dentry->d_sb;
244244

245-
if (!dentry)
246-
return NULL;
247-
sb = dentry->d_sb;
248245
while (1) {
249246
char *pos;
250247
struct inode *inode;
@@ -264,10 +261,8 @@ char *tomoyo_realpath_from_path(const struct path *path)
264261
inode = d_backing_inode(sb->s_root);
265262
/*
266263
* Get local name for filesystems without rename() operation
267-
* or dentry without vfsmount.
268264
*/
269-
if (!path->mnt ||
270-
(!inode->i_op->rename &&
265+
if ((!inode->i_op->rename &&
271266
!(sb->s_type->fs_flags & FS_REQUIRES_DEV)))
272267
pos = tomoyo_get_local_path(path->dentry, buf,
273268
buf_len - 1);

0 commit comments

Comments
 (0)