Commit 2fd60da4 authored by Peng Wang's avatar Peng Wang Committed by Greg Kroah-Hartman

kernfs: fix potential null pointer dereference

Get root safely after kn is ensureed to be not null.
Signed-off-by: default avatarPeng Wang <rocking@whu.edu.cn>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20190708151611.13242-1-rocking@whu.edu.cnSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 515db266
......@@ -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);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment