Re: [syzbot ci] Re: Create and use APIs to centralise locking for directory ops.
NeilBrown <[email protected]>
| Newsgroups | org.kernel.vger.ecryptfs,dev.linux.lists.netfs,dev.linux.lists.syzbot,org.kernel.vger.linux-cifs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs,org.kernel.vger.linux-security-module,org.kernel.vger.linux-unionfs,org.kernel.vger.linux-xfs,org.kernel.vger.selinux |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 06 Nov 2025, syzbot ci wrote: > syzbot ci has tested the following series > > [v5] Create and use APIs to centralise locking for directory ops. > https://lore.kernel.org/all/[email protected] > * [PATCH v5 01/14] debugfs: rename end_creating() to debugfs_end_creating() > * [PATCH v5 02/14] VFS: introduce start_dirop() and end_dirop() > * [PATCH v5 03/14] VFS: tidy up do_unlinkat() > * [PATCH v5 04/14] VFS/nfsd/cachefiles/ovl: add start_creating() and end_creating() > * [PATCH v5 05/14] VFS/nfsd/cachefiles/ovl: introduce start_removing() and end_removing() > * [PATCH v5 06/14] VFS: introduce start_creating_noperm() and start_removing_noperm() > * [PATCH v5 07/14] VFS: introduce start_removing_dentry() > * [PATCH v5 08/14] VFS: add start_creating_killable() and start_removing_killable() > * [PATCH v5 09/14] VFS/nfsd/ovl: introduce start_renaming() and end_renaming() > * [PATCH v5 10/14] VFS/ovl/smb: introduce start_renaming_dentry() > * [PATCH v5 11/14] Add start_renaming_two_dentries() > * [PATCH v5 12/14] ecryptfs: use new start_creating/start_removing APIs > * [PATCH v5 13/14] VFS: change vfs_mkdir() to unlock on failure. > * [PATCH v5 14/14] VFS: introduce end_creating_keep() > > and found the following issues: > * WARNING: lock held when returning to user space in start_creating > * possible deadlock in mnt_want_write > > Full report is available here: > https://ci.syzbot.org/series/4f406e4d-6aba-457a-b9c1-21f4407176a0 > > *** > > WARNING: lock held when returning to user space in start_creating I think this was due to a bug in VFS: change vfs_mkdir() to unlock on failure. in ovl_create_real() That patch removed a end_creating() call that was after ovl_create_real() returned failure, but didn't add end_creating() in ovl_create_real() on failure. So it could exit with the lock still held. This patch should fix it, particularly the second hunk. Thanks, NeilBrown diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index a4a0dc261310..739f974dc258 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -187,7 +187,7 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, struct dentry *parent, if (!err && ofs->casefold != ovl_dentry_casefolded(newdentry)) { pr_warn_ratelimited("wrong inherited casefold (%pd2)\n", newdentry); - dput(newdentry); + end_creating(newdentry); err = -EINVAL; } break; @@ -237,8 +237,7 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, struct dentry *parent, } out: if (err) { - if (!IS_ERR(newdentry)) - dput(newdentry); + end_creating(newdentry); return ERR_PTR(err); } return newdentry;