diff options
author | Peng Wang <rocking@whu.edu.cn> | 2019-07-08 11:16:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-25 09:30:48 -0400 |
commit | 2fd60da46da76948b8cc561ae8cc902209686253 (patch) | |
tree | 210588885a1e314349fca90aea6cfa5d3f11b3ef /fs/kernfs/dir.c | |
parent | 515db266a9dace92b0cbaed9a6044dd5304b8ca9 (diff) |
kernfs: fix potential null pointer dereference
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>
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r-- | fs/kernfs/dir.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index a387534c9577..ddf537923a0a 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -430,7 +430,6 @@ struct kernfs_node *kernfs_get_active(struct kernfs_node *kn) | |||
430 | */ | 430 | */ |
431 | void kernfs_put_active(struct kernfs_node *kn) | 431 | void kernfs_put_active(struct kernfs_node *kn) |
432 | { | 432 | { |
433 | struct kernfs_root *root = kernfs_root(kn); | ||
434 | int v; | 433 | int v; |
435 | 434 | ||
436 | if (unlikely(!kn)) | 435 | if (unlikely(!kn)) |
@@ -442,7 +441,7 @@ void kernfs_put_active(struct kernfs_node *kn) | |||
442 | if (likely(v != KN_DEACTIVATED_BIAS)) | 441 | if (likely(v != KN_DEACTIVATED_BIAS)) |
443 | return; | 442 | return; |
444 | 443 | ||
445 | wake_up_all(&root->deactivate_waitq); | 444 | wake_up_all(&kernfs_root(kn)->deactivate_waitq); |
446 | } | 445 | } |
447 | 446 | ||
448 | /** | 447 | /** |