mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+eede1fb91fb15bbbd5f2@syzkaller.appspotmail.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	miklos@szeredi.hu, syzkaller-bugs@googlegroups.com
Subject: [PATCH next] fuse: avoid using the same file descriptor when cloning
Date: Sun, 19 Apr 2026 13:26:56 +0800	[thread overview]
Message-ID: <tencent_B2A5880DD99212DDDF5D9E9915CFAC8D8607@qq.com> (raw)
In-Reply-To: <69e1934c.a70a0220.7229.0010.GAE@google.com>

In fuse_dev_install_with_pq(), after updating the chan for the new device,
the fch->connected value for the old device is set to 0. This logic is
fundamentally flawed in cases where the new fd passed during a clone
operation is identical to the device file's fd; specifically, during
an unmount operation, this prevents fuse_conn_destroy() and subsequently
fuse_chan_abort() from terminating pending requests, and the wake-up of
the blocked_waitq is also consequently skipped. This triggers a timeout
in fuse_chan_wait_aborted() [1].

The original conditional logic has been restored to correctly identify
the new device file.

[1]
INFO: task syz-executor:5986 blocked for more than 143 seconds.
Call Trace:
 fuse_chan_wait_aborted+0x15b/0x250 fs/fuse/dev.c:2212
 fuse_conn_destroy+0x1e7/0x3e0 fs/fuse/inode.c:1969
 fuse_sb_destroy fs/fuse/inode.c:1988 [inline]
 fuse_kill_sb_anon+0x1ef/0x270 fs/fuse/inode.c:2001
 deactivate_locked_super+0xbc/0x130 fs/super.c:476
 cleanup_mnt+0x437/0x4d0 fs/namespace.c:1312

Fixes: 88bf1f670f99 ("fuse: simplify fuse_dev_ioctl_clone()")
Reported-by: syzbot+eede1fb91fb15bbbd5f2@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=eede1fb91fb15bbbd5f2
Tested-by: syzbot+eede1fb91fb15bbbd5f2@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/fuse/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 25c5c853a791..7c130656c4f6 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2291,6 +2291,9 @@ static long fuse_dev_ioctl_clone(struct file *file, __u32 __user *argp)
 		return -ENOMEM;
 
 	new_fud = fuse_file_to_fud(file);
+	if (fuse_dev_chan_get(new_fud))
+		return -EINVAL;
+
 	if (!fuse_dev_install_with_pq(new_fud, fud->chan, pq))
 		return -EINVAL;
 
-- 
2.43.0


  parent reply	other threads:[~2026-04-19  5:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  1:56 [syzbot] [fuse?] INFO: task hung in fuse_conn_destroy (2) syzbot
2026-04-19  3:51 ` Edward Adam Davis
2026-04-19  5:15   ` syzbot
2026-04-19  5:26 ` Edward Adam Davis [this message]
2026-04-20 10:52   ` [PATCH next] fuse: avoid using the same file descriptor when cloning Miklos Szeredi

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=tencent_B2A5880DD99212DDDF5D9E9915CFAC8D8607@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=syzbot+eede1fb91fb15bbbd5f2@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

all inboxes | Powered by JetHome®