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);