From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Cc: Fan Gong <gongfan1@huawei.com>,
netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Xin Guo <guoxin09@huawei.com>, Gur Stavi <gur.stavi@huawei.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] hinic3: bound the Rx fragment count to MAX_SKB_FRAGS
Date: Sun, 18 Oct 2026 19:05:31 +0200 [thread overview]
Message-ID: <20261018170531.bILLh5Zw@linutronix.de> (raw)
In-Reply-To: <20261010030901.1712792-1-yhlee@isslab.korea.ac.kr>
On 2026-10-10 12:09:01 [+0900], Yehyeong Lee wrote:
> hinic3_rx_poll() takes the packet length from the Rx completion
> descriptor and turns it into a fragment count:
>
> pkt_len = RQ_CQE_SGE_GET(vlan_len, LEN);
> sge_num = pkt_len >> rxq->buf_len_shift ...
>
> RQ_CQE_SGE_LEN_MASK is a 16-bit field, so pkt_len is up to 65535 and
> sge_num up to 32 with the default 2048-byte buffers. packaging_skb()
> then calls skb_add_rx_frag() sge_num times without checking the count
> against MAX_SKB_FRAGS, so a device reporting a length above
> MAX_SKB_FRAGS * buf_len writes fragment descriptors past the end of the
> skb's shared info array.
>
> Driving the receive path with an out-of-range length reports under
> KASAN:
>
> BUG: KASAN: slab-out-of-bounds in hinic3_fetch_rx_buffer [hinic3]
> Write of size 8 ...
> The buggy address belongs to the object ...
> which belongs to the cache skbuff_small_head of size 704
>
> The length is chosen by the device and an skb cannot hold more than
> MAX_SKB_FRAGS fragments, so drop a frame that needs more instead of
> overrunning the array. The buffers it claimed are already posted on the
> ring, so return them to the page pool and advance the consumer index
> over them to keep it in step with the device.
>
> Fixes: 17fcb3dc12bb ("hinic3: module initialization and tx/rx logic")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
How do you run into this? With the default 17 frags and 2048 buffers
your packet is larger than 17 * 2048 = 34KiB. Is this with a large MTU
or does the HW merge packets on its own? Ideally you would like to avoid
this from happening. The user gets just a dropped packet with no clue
what is wrong.
Sebastian
next prev parent reply other threads:[~2026-10-18 17:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 3:09 [PATCH net] hinic3: bound the Rx fragment count to MAX_SKB_FRAGS Yehyeong Lee
2026-10-10 3:16 ` netdev-bot+sinfo
2026-10-18 17:05 ` Sebastian Andrzej Siewior [this message]
2026-10-19 0:10 ` Yehyeong Lee
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=20261018170531.bILLh5Zw@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gongfan1@huawei.com \
--cc=guoxin09@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=yhlee@isslab.korea.ac.kr \
/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