]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
kernfs: add missing kernfs_active() checks in directory operations
authorTejun Heo <tj@kernel.org>
Mon, 3 Feb 2014 19:09:11 +0000 (14:09 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Feb 2014 23:52:48 +0000 (15:52 -0800)
commitb9c9dad0c457d32cf8c7d2e413463c8414c7a7a7
treec20eaec5b60bb56f4b4873c2e06cde65edb59d7e
parent6a7fed4eefddad48224f1c9d534b4e262f0897f6
kernfs: add missing kernfs_active() checks in directory operations

kernfs_iop_lookup(), kernfs_dir_pos() and kernfs_dir_next_pos() were
missing kernfs_active() tests before using the found kernfs_node.  As
deactivated state is currently visible only while a node is being
removed, this doesn't pose an actual problem.  e.g. lookup succeeding
on a deactivated node doesn't harm anything as the eventual file
operations are gonna fail and those failures are indistinguishible
from the cases in which the lookups had happened before the node was
deactivated.

However, we're gonna allow new nodes to be created deactivated and
then activated explicitly by the kernfs user when it sees fit.  This
is to support atomically making multiple nodes visible to userland and
thus those nodes must not be visible to userland before activated.

Let's plug the lookup and readdir holes so that deactivated nodes are
invisible to userland.

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