We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2242c1 commit dd12fb6Copy full SHA for dd12fb6
fs/kernfs/dir.c
@@ -970,7 +970,13 @@ struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
970
*/
971
void kernfs_destroy_root(struct kernfs_root *root)
972
{
973
- kernfs_remove(root->kn); /* will also free @root */
+ /*
974
+ * kernfs_remove holds kernfs_rwsem from the root so the root
975
+ * shouldn't be freed during the operation.
976
+ */
977
+ kernfs_get(root->kn);
978
+ kernfs_remove(root->kn);
979
+ kernfs_put(root->kn); /* will also free @root */
980
}
981
982
/**
0 commit comments