Article View: linux.kernel.netdev
Article #24135Re: [PATCH net v5 2/2] net: atl1c: free the RX buffer when the descriptor reports an error
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 11:48
Date: Sun, 29 Nov 2026 11:48
124 lines
12656 bytes
12656 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In atl1c_clean_rx()
(drivers/net/ethernet/atheros/atl1c/atl1c_main.c), the new RRD check…
--
net: atl1c: free the RX buffer when the descriptor reports an error
This commit changes atl1c_clean_rx() so that errored frames no longer
leak their skb and DMA mapping: the buffer is now unmapped and freed. It
also checks the RFD count and index in each RRD against
rfd_ring->next_to_clean. On a mismatch it schedules an adapter reset
through ATL1C_WORK_EVENT_RESET. Finally, it adds a dma_rmb() after the
valid-bit test and clears the RRD ring in atl1c_clean_rx_ring().
> diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> index afab3e16903ba..8383203623c17 100644
> --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
> +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
[ ... ]
> @@ -1952,47 +1947,66 @@ static int atl1c_clean_rx(struct napi_struct *napi, int budget)
> if (work_done >= budget)
> break;
> rrs = ATL1C_RRD_DESC(rrd_ring, rrd_ring->next_to_clean);
> - if (likely(RRS_RXD_IS_VALID(rrs->word3))) {
> - rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) &
> - RRS_RX_RFD_CNT_MASK;
> - if (unlikely(rfd_num != 1))
> - /* TODO support mul rfd*/
> - if (netif_msg_rx_err(adapter))
> - dev_warn(&pdev->dev,
> - "Multi rfd not support yet!\n");
> - goto rrs_checked;
> - } else {
> + if (!RRS_RXD_IS_VALID(rrs->word3))
> + break;
> +
[ ... ]
> + rrs_word0 = le32_to_cpu(rrs->word0);
> + rfd_num = (rrs_word0 >> RRS_RX_RFD_CNT_SHIFT) &
> + RRS_RX_RFD_CNT_MASK;
> + rfd_index = (rrs_word0 >> RRS_RX_RFD_INDEX_SHIFT) &
> + RRS_RX_RFD_INDEX_MASK;
> + buffer_info = &rfd_ring->buffer_info[rfd_ring->next_to_clean];
> +
[ ... ]
> + if (unlikely(rfd_num != 1 ||
> + rfd_index != rfd_ring->next_to_clean ||
> + !buffer_info->skb)) {
> + dev_err_ratelimited(&pdev->dev,
> + "RRD out of sync: RFD count %u index %u, expected index %u%s; resetting\n",
> + rfd_num, rfd_index,
> + rfd_ring->next_to_clean,
> + buffer_info->skb ? "" : " (no buffer)");
> + set_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event);
> + schedule_work(&adapter->common_task);
> break;
> }
[Severity: Medium]
Can this check turn a legitimate multi-RFD frame into a full controller
reset?
For any mtu <= 1522, atl1c_set_rxbufsize() leaves rx_buffer_len at
AT_RX_BUF_SIZE (1522):
adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ?
roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE;
atl1c_configure_rx() writes that value to REG_RX_BUF_SIZE. Meanwhile
atl1c_configure_mac() sets the MAC frame limit to mtu + 22:
AT_WRITE_REG(hw, REG_MTU, hw->max_frame_size + ETH_HLEN +
VLAN_HLEN + ETH_FCS_LEN);
So with 1501 <= mtu <= 1522 (mtu 1508 for RFC 4638 PPPoE, for example),
the MAC accepts frames of up to 1523..1544 bytes into 1522-byte RFDs.
Suppose the device splits such a frame over two RFDs and reports
RRS_RX_RFD_CNT = 2. This branch then sets ATL1C_WORK_EVENT_RESET, and
atl1c_common_task() runs netif_device_detach(), atl1c_down() and
atl1c_up() once per frame.
Errored multi-RFD frames (RRS_RX_ERR_SUM or RRS_802_3_LEN_ERR) used to
be consumed by atl1c_clean_rrd() and atl1c_clean_rfd() with rfd_num, and
RX carried on. With this patch they also reset the controller. Nothing
limits how often the reset can be scheduled, so a peer that keeps sending
such frames could keep the link flapping.
The commit message names alx_clean_rx_irq() as the model. alx can treat
a count other than 1 as fatal because its rxbuf_size comes from
ALX_MAX_FRAME_LEN(mtu), which is always at least the ALX_MTU register
value. atl1c does not hold to that for mtu 1501..1522.
It isn't confirmed whether the hardware splits an oversized frame across
RFDs or truncates it into one. The old "TODO support mul rfd" branches
and the 4-bit RFD count field suggest that splitting can happen.
Would it work to size rx_buffer_len from the same expression as REG_MTU,
for example max(AT_RX_BUF_SIZE, roundup(mtu + ETH_HLEN + VLAN_HLEN +
ETH_FCS_LEN, 8))? Another option is to drop and recycle a multi-RFD frame
whose index matches next_to_clean, and keep the reset for a real desync.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125113120.99743-1-federico%40rimpianto.com
Technical Details
Message-ID:
<179595291831.3146.7906490727635927112@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373471-linux-kernel-netdev=dewy.ruReferences:
<20261125113120.99743-3-federico@rimpianto.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373471-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v5 2/2] net: atl1c: free the RX buffer when the descriptor reports an error Date: Sun, 29 Nov 2026 11:48:38 +0000 Organization: Usenet Network Message-ID: <179595291831.3146.7906490727635927112@kernel.org> References: <20261125113120.99743-3-federico@rimpianto.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1161656"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:JPSCcmd+QcnPeMHwlZbabxdUbvg= sha256:LSoiCruwoBftbberioK2vJ8rLwKr0FgR+nxy5iBjDFo= sha1:721LiEtKLA9+K/ZmyH2ssFaPLSY= sha256:ig0JOTzbDI5xqmbDuj23N/9Ogb2YziBThHdJCDa3PZY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 8BD1B125F97; Sun, 29 Nov 2026 14:49:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5P_jn_QqrOit; Sun, 29 Nov 2026 14:49:04 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373471-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 3CEB8125CEE; Sun, 29 Nov 2026 14:48:56 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 6FCF724662; Sun, 29 Nov 2026 11:48:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795952934; b=2RP/98QIuAzJQj12FOpfK1qq8j27SDMzARVMdYIsYoBiU68myD24x4rWEp6yFEPvELCi uErWs4K9klWqZyx6YwFxcHuNxh8sKOy2TDDjvpTAsFHo2R0uSr89+sTUGUsSaCwVPppWc usJYSlHNBCJWeT+qNynuMMSEBSxCHrS+JTKaNd8cRKS/NkbAYnyKUPN6c3JdPOV8LcVPG /puYTMWh4fV1Lx1ABmFIOyQpEjBrtIBffrfK9uF8JN7E/YKFEcIk3EVbTrElvCP9cpdHX WF6yYciJBHY8TjjUxlfqsIT7oDoJ9vlLfKmv9FLkERH03OlALFWtB63w+CC9kk/gntQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795952934; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=kS6JL0POCY79q/fEv/wHJhbi/ERUzjTOB4fymdB09fw=; b=DggGm3kIyRDL0v17/yckKaHYrv+8+Q780uBxeCCp8aMcAcfIur8jsAuFA1946czEnjVL rGufmAnA9TCP/SX6KYmt3+lzkOcIRY+bbbDwQnyr1CThaJw5tcYKbfYFq01knJI4KJOkN lY2tU2tf+BE29vegyCA7sfktnb+0vY722Ko1tlPb8Yysb1cQtkLuWmex71KvRdOlbNfP7 otIFtgKbHRka6lDkIHxXIIwL8WHzezYGwfSVU4Jfl+tBPiD+0xMd3ZiarIChQKHWEsxdV lBaeo6ktnG4zP5t7UbEXC3nOERta/rCj5xPrNl76+FODRWt6pYMaT683PFhzdsnGvFw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BgYj6w0D; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19E62606A6A8; Sun, 29 Nov 2026 11:48:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BgYj6w0D X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795952919; b=SHcq35Bv1PLdViMR3RtdAp85yNZPLMlhIJd9jxsqWnVKaqDfM/XXxrD+/nryOLXKAXtI jyfc8CPB1dWh+to5Si99WpTE/gRqsLf5laSpjBeT51HXkO7Feln+A3XQiJOTTF8MHHgth lA1fzbHNXGMt5HIY46g1j0fehsyTtM3VNdn96R/L4h8vCYdQFqzIfscFkWc+nlRe0zGrD E4C9B4wPPzO/oVJtvcvB2AHK/01w+VSIaz8FG8f4TS/4l+icft+/EpliBcAsIIktB/jZw 7E4Alux/wPcNIdMBL+UxIXfbQ4Zn8SY8Ydx1L5ZmV9Vh+jbnBFGv61tTODHS3sbWE/Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795952919; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=kS6JL0POCY79q/fEv/wHJhbi/ERUzjTOB4fymdB09fw=; b=23SFB6YRHIwfkHq4VwH9kMsxTsRiahpz32yicqFyv5mZGp+Cgwq3ah6nHUquZxE3rk2j 2tJNk9EexAQLUny4COxT/oUeROZr9f73PK7KJUQ86m7beBhhdolzEjiCbn5aii3DwQ7e2 +RobVv3qORmtKKrwhCTXOenmV5Yt85Y+IyjXFKbssITRlsi6cA+/xipcYX80vkyiOgvxd flL7akFnZWk0+J3VAP211vcqtzBIFEIqBKKIlhOcTFGsYSN2zCy2qtuOl1KtqQIT8iPYb eIaIvJ22aT9Y7+XOB0Z0dHv2Nid30kY/VcQjlhMM3YFgmKDRnTfhUJR6/RjtNs5MAdQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BgYj6w0D; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7303A606A68F; Sun, 29 Nov 2026 11:48:39 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C21C71F00896; Sun, 29 Nov 2026 11:48:38 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795952919; bh=kS6JL0POCY79q/fEv/wHJhbi/ERUzjTOB4fymdB09fw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BgYj6w0Dj/oRGZkpourOmKNFNHJ3pww0yfPWzusAGG7fU3W/HFgYIVEDWuvongwnG K7wpHRIOnN97HTMubvsytDVGcMvPuNSg3taiH0lYzBA0aGSYdo8hObpAJlAcgcM9CN 19c0jr3Yij7hPXaReyjWDMwxmB73XbLUdtzyrmo+gVfVvkGN04A1INuLUtLp4EeKMy tTXBSe2IZJ0BZNWTaPPgPcVQTl0KFGVNJKbII+pyiovQjGpROPgGZKwptUuzPLYTW2 734T4d0xcoizWQ3in9w/hXzMvBCfEfXFjiklOahFPUSIaE2hVFdT9rRudPUecMbcud jE+y17x1TIwMQ== X-Cc: chris.snook@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261125113120.99743-3-federico@rimpianto.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list