Skip to content

Commit 1586a70

Browse files
committed
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
2 parents ab29622 + 467cf8e commit 1586a70

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

security/tomoyo/audit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ void tomoyo_write_log(struct tomoyo_request_info *r, const char *fmt, ...)
423423
int len;
424424

425425
va_start(args, fmt);
426-
len = vsnprintf((char *) &len, 1, fmt, args) + 1;
426+
len = vsnprintf(NULL, 0, fmt, args) + 1;
427427
va_end(args);
428428
va_start(args, fmt);
429429
tomoyo_write_log2(r, len, fmt, args);

security/tomoyo/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,7 @@ int tomoyo_supervisor(struct tomoyo_request_info *r, const char *fmt, ...)
20572057
bool quota_exceeded = false;
20582058

20592059
va_start(args, fmt);
2060-
len = vsnprintf((char *) &len, 1, fmt, args) + 1;
2060+
len = vsnprintf(NULL, 0, fmt, args) + 1;
20612061
va_end(args);
20622062
/* Write /sys/kernel/security/tomoyo/audit. */
20632063
va_start(args, fmt);

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)