From: Peng Wang rocking@whu.edu.cn
mainline inclusion from mainline-5.4-rc1 commit 2fd60da46da76948b8cc561ae8cc902209686253 category: bugfix bugzilla: 21637 CVE: NA
---------------------------
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 Signed-off-by: yu kuai yukuai3@huawei.com Reviewed-by: zhangyi (F) yi.zhang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/kernfs/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index a4a538a..7fa9403 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -431,7 +431,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)) @@ -443,7 +442,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); }
/**