summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/kernfs/dir.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 4076e8a7c269..a8028be6cdb7 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -920,6 +920,9 @@ static void __kernfs_remove(struct kernfs_node *kn)
lockdep_assert_held(&kernfs_mutex);
+ if (!kn)
+ return;
+
pr_debug("kernfs %s: removing\n", kn->name);
__kernfs_deactivate(kn);