summaryrefslogtreecommitdiff
path: root/fs/kernfs
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-02 14:56:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-02 14:56:48 +0300
commit0e509f537f8ddd89f237e62f77818dbdbc8be395 (patch)
tree4e747a1cad81d0c085d435923366bcce30484bc8 /fs/kernfs
parentf8ae07f4b8bfde0f33761e1a1aaee45a4e85e9d6 (diff)
parent672c0c5173427e6b3e2a9bbb7be51ceeec78093a (diff)
downloadlinux-0e509f537f8ddd89f237e62f77818dbdbc8be395.tar.xz
Merge 5.18-rc5 into driver-core-next
We need the kernfs/driver core fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r--fs/kernfs/dir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 61a8edc4ba8b..e205fde7163a 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -1406,7 +1406,12 @@ static void __kernfs_remove(struct kernfs_node *kn)
*/
void kernfs_remove(struct kernfs_node *kn)
{
- struct kernfs_root *root = kernfs_root(kn);
+ struct kernfs_root *root;
+
+ if (!kn)
+ return;
+
+ root = kernfs_root(kn);
down_write(&root->kernfs_rwsem);
__kernfs_remove(kn);