summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorHongling Zeng <zenghongling@kylinos.cn>2026-06-17 16:50:49 +0800
committerChristian Brauner <brauner@kernel.org>2026-07-01 15:26:25 +0200
commit8c256fba2b46020004201c500b2a1fbc707a33ef (patch)
tree085fb97171bb099a9239e2f770becba075ff9804 /fs
parentfb3e566cafc38fe3ba35e6843a2d529a3748870c (diff)
downloadlwn-8c256fba2b46020004201c500b2a1fbc707a33ef.tar.gz
lwn-8c256fba2b46020004201c500b2a1fbc707a33ef.zip
cachefiles: Fix double unlock in nomem_d_alloc error path
When start_creating() fails and returns -ENOMEM, it has already released the parent directory lock in __start_dirop(): static struct dentry *__start_dirop(...) { ... inode_lock_nested(dir, I_MUTEX_PARENT); dentry = lookup_one_qstr_excl(name, parent, lookup_flags); if (IS_ERR(dentry)) inode_unlock(dir); <-- Lock released on error return dentry; } However, the nomem_d_alloc error path in cachefiles_get_directory() unconditionally calls inode_unlock(d_inode(dir)) again, causing a double unlock that corrupts the rwsem state. This is a leftover from commit 7ab96df840e60 which replaced manual locking with start_creating() but failed to update the nomem_d_alloc path (while correctly updating mkdir_error and lookup_error paths). Fixes: 7ab96df840e6 ("VFS/nfsd/cachefiles/ovl: add start_creating() and end_creating()") Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn> Link: https://patch.msgid.link/20260617085049.730789-1-zenghongling@kylinos.cn Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cachefiles/namei.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 2937db690b40..2c46f0decb02 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -209,7 +209,6 @@ lookup_error:
return ERR_PTR(ret);
nomem_d_alloc:
- inode_unlock(d_inode(dir));
_leave(" = -ENOMEM");
return ERR_PTR(-ENOMEM);
}