[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190705134730.20833-1-rocking@whu.edu.cn>
Date: Fri, 5 Jul 2019 21:47:30 +0800
From: Peng Wang <rocking@....edu.cn>
To: gregkh@...uxfoundation.org, tj@...nel.org
Cc: linux-kernel@...r.kernel.org, Peng Wang <rocking@....edu.cn>
Subject: [PATCH] kernfs: fix potential null pointer dereference
Get root safely after kn is ensureed to be not null.
Signed-off-by: Peng Wang <rocking@....edu.cn>
---
fs/kernfs/dir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index a387534c9577..ea3fc972c48b 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -430,7 +430,7 @@ 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);
+ struct kernfs_root *root;
int v;
if (unlikely(!kn))
@@ -442,6 +442,7 @@ void kernfs_put_active(struct kernfs_node *kn)
if (likely(v != KN_DEACTIVATED_BIAS))
return;
+ root = kernfs_root(kn);
wake_up_all(&root->deactivate_waitq);
}
--
2.19.1
Powered by blists - more mailing lists