Message ID | 20240102151249.05da244d@gandalf.local.home (mailing list archive) |
---|---|
State | Accepted |
Commit | ad579864637af46447208254719943179b69d41a |
Headers | show |
Series | [v2] tracefs: Check for dentry->d_inode exists in set_gid() | expand |
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 62524b20964e..bc86ffdb103b 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -215,6 +215,10 @@ static void set_gid(struct dentry *parent, kgid_t gid) struct dentry *dentry = list_entry(tmp, struct dentry, d_child); next = tmp->next; + /* Note, getdents() can add a cursor dentry with no inode */ + if (!dentry->d_inode) + continue; + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); change_gid(dentry, gid);