Re: [syzbot] [fs?] [trace?] BUG: unable to handle kernel paging request in tracefs_apply_options

From: Edward Adam Davis
Date: Thu Jan 04 2024 - 08:45:08 EST


please test unable to handle kernel paging request in tracefs_apply_options

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 453f5db0619e

diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index 62524b20964e..51eacb5f4e08 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -220,9 +220,11 @@ static void set_gid(struct dentry *parent, kgid_t gid)
change_gid(dentry, gid);

/* If this is the events directory, update that too */
- ti = get_tracefs(dentry->d_inode);
- if (ti && (ti->flags & TRACEFS_EVENT_INODE))
- eventfs_update_gid(dentry, gid);
+ if (!IS_ERR_OR_NULL(dentry->d_inode)) {
+ ti = get_tracefs(dentry->d_inode);
+ if (ti && (ti->flags & TRACEFS_EVENT_INODE))
+ eventfs_update_gid(dentry, gid);
+ }

if (!list_empty(&dentry->d_subdirs)) {
spin_unlock(&this_parent->d_lock);