kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR
PATCH v2 1/1 kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR
The root->ino_idr is supposed to be protected by kernfs_idr_lock, fix it.
Fixes 488dee96bb62 ("kernfs: allow creating kernfs objects with arbitrary uid/gid")
Signed-off-by Muchun Song <[email protected]>
---
v2:
- Open code the locking.
fs/kernfs/dir.c | 2 ++ 1 file changed, 2 insertions(+)
fs/kernfs/dir.c +2 -0
@@ -655,7 +655,9 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,return kn; err_out3: +spin_lock (&kernfs_idr_lock);idr_remove (&root->ino_idr, (u32 )kernfs_ino (kn)); +spin_unlock (&kernfs_idr_lock); err_out2:kmem_cache_free (kernfs_node_cache, kn); err_out1:
Signature · 1 line
2.11.0
Quoted 5 lines · Muchun Song
The
root->ino_idris supposed to be protected bykernfs_idr_lock, fix it.Fixes 488dee96bb62 ("kernfs: allow creating kernfs objects with arbitrary uid/gid")Signed-off-by Muchun Song <[email protected]>
Acked-by Tejun Heo <[email protected]>
Thanks.
Signature · 1 line
tejun