• Tejun Heo's avatar
    kernfs: add missing kernfs_active() checks in directory operations · b9c9dad0
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    b9c9dad0
dir.c 29.5 KB