]> git.baikalelectronics.ru Git - kernel.git/commit
kernfs: kernfs_find_and_get_node_by_ino() should only look up activated nodes
authorTejun Heo <tj@kernel.org>
Mon, 4 Nov 2019 23:54:29 +0000 (15:54 -0800)
committerTejun Heo <tj@kernel.org>
Tue, 12 Nov 2019 16:18:03 +0000 (08:18 -0800)
commit7915f8a155940cdb48cceb00339b36a21e4ffc5c
treefc28379549f13b2ac6d4cbf1171b3d31aba6b470
parent6d184d22545814da4bf1d621b0ed598d6a60dc13
kernfs: kernfs_find_and_get_node_by_ino() should only look up activated nodes

kernfs node can be created in two separate steps - allocation and
activation.  This is used to make kernfs nodes visible only after the
internal states attached to the node are fully initialized.
kernfs_find_and_get_node_by_id() currently allows lookups of nodes
which aren't activated yet and thus can expose nodes are which are
still being prepped by kernfs users.

Fix it by disallowing lookups of nodes which aren't activated yet.

kernfs_find_and_get_node_by_ino()

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
fs/kernfs/dir.c