public inbox for linux-unionfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+bfc9a0ccf0de47d04e8c@syzkaller.appspotmail.com>
Cc: NeilBrown <neilb@ownmail.net>,
	amir73il@gmail.com, brauner@kernel.org,
	linux-kernel@vger.kernel.org, linux-unionfs@vger.kernel.org,
	miklos@szeredi.hu, syzkaller-bugs@googlegroups.com,
	NeilBrown <neil@brown.name>
Subject: Re: [PATCH] ovl: fail ovl_lock_rename_workdir() if either target is unhashed
Date: Fri, 28 Nov 2025 14:55:20 +0800	[thread overview]
Message-ID: <20251128065521.9509-1-hdanton@sina.com> (raw)
In-Reply-To: <176429295510.634289.1552337113663461690@noble.neil.brown.name>

#syz test upstream master

From: NeilBrown <neil@brown.name>

As well as checking that the parent hasn't changed after getting the
lock we need to check that the dentry hasn't been unhashed.
Otherwise we might try to rename something that has been removed.

Reported-by: syzbot+bfc9a0ccf0de47d04e8c@syzkaller.appspotmail.com
Fixes: d2c995581c7c ("ovl: Call ovl_create_temp() without lock held.")
Signed-off-by: NeilBrown <neil@brown.name>
---
 fs/overlayfs/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index f76672f2e686..82373dd1ce6e 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -1234,9 +1234,9 @@ int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *work,
 		goto err;
 	if (trap)
 		goto err_unlock;
-	if (work && work->d_parent != workdir)
+	if (work && (work->d_parent != workdir || d_unhashed(work)))
 		goto err_unlock;
-	if (upper && upper->d_parent != upperdir)
+	if (upper && (upper->d_parent != upperdir || d_unhashed(upper)))
 		goto err_unlock;

 	return 0;
--
2.50.0.107.gf914562f5916.dirty

  reply	other threads:[~2025-11-28  6:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 20:36 [syzbot] [overlayfs?] WARNING in shmem_unlink (2) syzbot
2025-11-27 21:42 ` NeilBrown
2025-11-27 23:41   ` Hillf Danton
2025-11-27 23:56     ` syzbot
2025-11-28  1:16     ` NeilBrown
2025-11-28  1:22 ` [PATCH] ovl: fail ovl_lock_rename_workdir() if either target is unhashed NeilBrown
2025-11-28  6:55   ` Hillf Danton [this message]
2025-11-28  7:28     ` [syzbot] [overlayfs?] WARNING in shmem_unlink (2) syzbot
2025-11-28  9:39   ` [PATCH] ovl: fail ovl_lock_rename_workdir() if either target is unhashed Christian Brauner
2025-11-28  9:54   ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251128065521.9509-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=neil@brown.name \
    --cc=neilb@ownmail.net \
    --cc=syzbot+bfc9a0ccf0de47d04e8c@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox