]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
kernfs: fix potential null pointer dereference
authorPeng Wang <rocking@whu.edu.cn>
Mon, 8 Jul 2019 15:16:11 +0000 (23:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2019 13:30:48 +0000 (15:30 +0200)
Get root safely after kn is ensureed to be not null.

Signed-off-by: Peng Wang <rocking@whu.edu.cn>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20190708151611.13242-1-rocking@whu.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/kernfs/dir.c

index a387534c9577855b6ea6d8e2868e4f85c52551b4..ddf537923a0aff320e48bc6e48c350833807dd91 100644 (file)
@@ -430,7 +430,6 @@ struct kernfs_node *kernfs_get_active(struct kernfs_node *kn)
  */
 void kernfs_put_active(struct kernfs_node *kn)
 {
-       struct kernfs_root *root = kernfs_root(kn);
        int v;
 
        if (unlikely(!kn))
@@ -442,7 +441,7 @@ void kernfs_put_active(struct kernfs_node *kn)
        if (likely(v != KN_DEACTIVATED_BIAS))
                return;
 
-       wake_up_all(&root->deactivate_waitq);
+       wake_up_all(&kernfs_root(kn)->deactivate_waitq);
 }
 
 /**