mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
kernfs: fix missing kernfs_idr_lock to remove an ID from the IDR
[ Upstream commit30480b988f
] The root->ino_idr is supposed to be protected by kernfs_idr_lock, fix it. Fixes:488dee96bb
("kernfs: allow creating kernfs objects with arbitrary uid/gid") Signed-off-by: Muchun Song <songmuchun@bytedance.com> Acked-by: Tejun Heo <tj@kernel.org> Link: https://lore.kernel.org/r/20230523024017.24851-1-songmuchun@bytedance.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fc52289156
commit
0c5631b116
1 changed files with 2 additions and 0 deletions
|
@ -655,7 +655,9 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
|
||||||
return kn;
|
return kn;
|
||||||
|
|
||||||
err_out3:
|
err_out3:
|
||||||
|
spin_lock(&kernfs_idr_lock);
|
||||||
idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
|
idr_remove(&root->ino_idr, (u32)kernfs_ino(kn));
|
||||||
|
spin_unlock(&kernfs_idr_lock);
|
||||||
err_out2:
|
err_out2:
|
||||||
kmem_cache_free(kernfs_node_cache, kn);
|
kmem_cache_free(kernfs_node_cache, kn);
|
||||||
err_out1:
|
err_out1:
|
||||||
|
|
Loading…
Reference in a new issue