From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+f6fdb3bdd2c1d419e263@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [v9fs?] WARNING: refcount bug in p9_req_put (4)
Date: Sat, 6 Jun 2026 21:11:24 +0800 [thread overview]
Message-ID: <20260606131125.1604-1-hdanton@sina.com> (raw)
In-Reply-To: <6a240600.c25708ab.1b19ef.0003.GAE@google.com>
> Date: Sat, 06 Jun 2026 04:35:28 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: ba3e43a9e601 Merge tag 'soc-fixes-7.1-2' of git://git.kern..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12b65a86580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=8118209836970b54
> dashboard link: https://syzkaller.appspot.com/bug?extid=f6fdb3bdd2c1d419e263
> compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=158b5f2e580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13d47dd2580000
#syz test
--- x/net/9p/client.c
+++ y/net/9p/client.c
@@ -181,11 +181,18 @@ p9_tag_alloc(struct p9_client *c, int8_t
p9pdu_reset(&req->rc);
req->t_err = 0;
req->status = REQ_STATUS_ALLOC;
- /* refcount needs to be set to 0 before inserting into the idr
- * so p9_tag_lookup does not accept a request that is not fully
- * initialized. refcount_set to 2 below will mark request ready.
+ req->tc.tag = -1;
+ /* Init ref to two because in the general case there is one ref
+ * that is put asynchronously by a writer thread, one ref
+ * temporarily given by p9_tag_lookup and put by p9_client_cb
+ * in the recv thread, and one ref put by p9_req_put in the
+ * main thread. The only exception is virtio that does not use
+ * p9_tag_lookup but does not have a writer thread either
+ * (the write happens synchronously in the request/zc_request
+ * callback), so p9_client_cb eats the second ref there
+ * as the pointer is duplicated directly by virtqueue_add_sgs()
*/
- refcount_set(&req->refcount, 0);
+ refcount_set(&req->refcount, 2);
init_waitqueue_head(&req->wq);
INIT_LIST_HEAD(&req->req_list);
@@ -202,18 +209,6 @@ p9_tag_alloc(struct p9_client *c, int8_t
if (tag < 0)
goto free;
- /* Init ref to two because in the general case there is one ref
- * that is put asynchronously by a writer thread, one ref
- * temporarily given by p9_tag_lookup and put by p9_client_cb
- * in the recv thread, and one ref put by p9_req_put in the
- * main thread. The only exception is virtio that does not use
- * p9_tag_lookup but does not have a writer thread either
- * (the write happens synchronously in the request/zc_request
- * callback), so p9_client_cb eats the second ref there
- * as the pointer is duplicated directly by virtqueue_add_sgs()
- */
- refcount_set(&req->refcount, 2);
-
return req;
free:
--
next prev parent reply other threads:[~2026-06-06 13:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-06 11:35 syzbot
2026-06-06 13:11 ` Hillf Danton [this message]
2026-06-06 13:33 ` syzbot
2026-06-06 21:41 ` Hillf Danton
2026-06-06 22:08 ` syzbot
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=20260606131125.1604-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+f6fdb3bdd2c1d419e263@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®