From: xietangxin <xietangxin@h-partners.com>
To: <syzbot+80dfcb1a2235b3efc877@syzkaller.appspotmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Simon Horman <horms@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
<lucien.xin@gmail.com>, <marcelo.leitner@gmail.com>,
Paolo Abeni <pabeni@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-sctp@vger.kernel.org>,
<netdev@vger.kernel.org>, <syzkaller-bugs@googlegroups.com>,
gaoxingwang <gaoxingwang1@huawei.com>, <huyizhen2@huawei.com>
Subject: Re: [syzbot] [sctp?] WARNING: refcount bug in sctp_transport_put (6)
Date: Tue, 1 Sep 2026 11:47:27 +0800 [thread overview]
Message-ID: <68cb4941-3668-44f1-a889-6b2f023b2a08@h-partners.com> (raw)
In-Reply-To: <6a7d8773.c5ad36c8.12f49d.002e.GAE@google.com>
Hi,
I have analyzed this issue and successfully reproduced locally.
The race occurs between the timer callback (`sctp_generate_heartbeat_event`) and
the transport cleanup path (`sctp_transport_free`):
Task 1(Timer Softirq) Task 2(sctp_transport_free)
========================== ===============================
sctp_generate_heartbeat_event()
refcnt = 2
bh_lock_sock(sk)
sock_owned_by_user(sk)
mod_timer(&hb_timer) -> returns 0
sctp_transport_free()
transport->dead = 1
del_timer(&hb_timer) -> returns 1!
sctp_transport_put() (2 -> 1)
sctp_transport_put() (1 -> 0)
sctp_transport_destroy()
sctp_transport_hold()
-> refcnt is 0, increment fails
out_unlock:
sctp_transport_put() (0 -> -1)
-> refcount underflow warning!
Adding a small delay after `mod_timer()` increases the reproduction rate:
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -373,8 +373,10 @@ void sctp_generate_heartbeat_event(struct timer_list *t)
pr_debug("%s: sock is busy\n", __func__);
/* Try again later. */
- if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20)))
+ if (!mod_timer(&transport->hb_timer, jiffies + (HZ/20))) {
+ mdelay(1);
sctp_transport_hold(transport);
+ }
goto out_unlock;
}
Any feedback or guidance would be greatly appreciated.
--
Best regards,
Tangxin Xie
next prev parent reply other threads:[~2026-09-01 3:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 8:59 [syzbot] [sctp?] WARNING: refcount bug in sctp_transport_put (6) syzbot
2026-09-01 3:47 ` xietangxin [this message]
2026-09-01 13:45 ` Xin Long
2026-09-01 14:35 ` David Laight
2026-09-01 15:06 ` Xin Long
2026-09-01 21:46 ` David Laight
2026-09-03 3:22 ` xietangxin
2026-09-03 14:00 ` Xin Long
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=68cb4941-3668-44f1-a889-6b2f023b2a08@h-partners.com \
--to=xietangxin@h-partners.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gaoxingwang1@huawei.com \
--cc=horms@kernel.org \
--cc=huyizhen2@huawei.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+80dfcb1a2235b3efc877@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