Commit aed47dda authored by Yushan Zhou's avatar Yushan Zhou Committed by Lee Jones
Browse files

BACKPORT: kernfs: fix potential NULL dereference in __kernfs_remove



When lockdep is enabled, lockdep_assert_held_write would
cause potential NULL pointer dereference.

Fix the following smatch warnings:

fs/kernfs/dir.c:1353 __kernfs_remove() warn: variable dereferenced before check 'kn' (see line 1346)

Bug: 254441685
Fixes: 393c3714 ("kernfs: switch global kernfs_rwsem lock to per-fs lock")
Signed-off-by: default avatarYushan Zhou <katrinzhou@tencent.com>
Link: https://lore.kernel.org/r/20220630082512.3482581-1-zys.zljxml@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 72b5d5ae)
[Lee: Trivial conflict resolution]
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: I529ce9af79d50a3e2ba415c63d783641e7131a79
parent b8494a04
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment