Commit 30480b98 authored by Muchun Song's avatar Muchun Song Committed by Greg Kroah-Hartman
Browse files

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: 488dee96 ("kernfs: allow creating kernfs objects with arbitrary uid/gid")
Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230523024017.24851-1-songmuchun@bytedance.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bea9ea6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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: