🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26371

Re: [PATCH net 1/2] net: bcm4908_enet: keep the RX buffer when the refill fails

#26371
From: Kordian Chmielewski
Date: Thu, 03 Dec 2026 12:33
45 lines
12753 bytes
> [Severity: High]
> This drop path assumes every slot holds a valid mapped buffer. Can that
> assumption break when the refill fails at open time?

[ ... ]

> Should bcm4908_enet_open() check the return value of
> bcm4908_enet_dma_init() and unwind, calling free_irq() for both IRQs and
> returning the error?

Yes. open() ignoring that error is older than this patch, and it is the
first of the follow-ups listed in the cover letter.

When open() carries on after bcm4908_enet_dma_init() failed, the RX
ring is left in a broken state with or without this patch. The
descriptors before the failed slot still carry OWN and the bus
addresses of buffers that the error path has unmapped and freed.
bcm4908_enet_dma_ring_init() has not run, so the RX channel is enabled
with the descriptor base that bcm4908_enet_dma_reset() set to 0. And a
refill that works still passes the slot's NULL buffer to build_skb() or
skb_free_frag(), as the review describes.

The commit message is about a slot that a failed refill in poll_rx()
leaves empty, which this patch stops; here the slots are empty because
open() went on after the error.

What this patch changes in that state is a refill that fails: the
descriptor is now re-armed with the stale or zero address of the slot
and the loop moves on, where the old code stopped without writing the
descriptor.

> Can the device then write packet data into memory the driver no longer
> owns?

In that state the drop path can hand the DMA a freed or zero address,
as the error path already does for the descriptors before the failed
slot.

The fix is for open() to fail and unwind. I will send it next, together
with a fix for the napi_alloc_frag() point, which the cover letter lists
as well. If the maintainers would rather have the open() fix in this
series, before this patch, I will send a v2 with it.

Kordian
Technical Details
Message-ID: <20261203123347.205398-1-kudzo51@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376597-linux-kernel-netdev=dewy.ru
References: <179629488517.3146.16278518529618524423@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376597-linux-kernel-netdev=dewy.ru
From: kudzo51@gmail.com (Kordian Chmielewski)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/2] net: bcm4908_enet: keep the RX buffer when the refill fails
Date: Thu,  3 Dec 2026 13:33:47 +0100
Organization: Usenet Network
Message-ID: <20261203123347.205398-1-kudzo51@gmail.com>
References: <179629488517.3146.16278518529618524423@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2488571"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:dmMUkdQDJYiL9Y8SfZrK40ZoNYI= sha256:XmY+K5dDn+XUiRyldi+w9en0SrG02hQ50XmpJeBtUnQ=
	sha1:C9LFr0PxXWgNBdOYixurQCYVTX0= sha256:XPWVLUjzs1ajDjpF6aj2tq1kOv6bBQU/Q+53watPGZM=
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 4C3A411793B; Thu,  3 Dec 2026 15:36:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.297
X-Spam-Status: No, score=-3.297 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 kuIopZr-CEDj;
	Thu,  3 Dec 2026 15:36:09 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376597-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 610D21178EF; Thu,  3 Dec 2026 15:35:58 +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 B276228DE7; Thu,  3 Dec 2026 12:35:55 +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=1796301354;
	b=XaQMUkx4qxQjgRSFTGQRvxxRusIzwEklkIh2KUSNY5Ef8AxfkVUtKOamYRTXofPe7uq8
	 IamQ8R70rJjjCGL4aeqIsfvbl0On24+vu/NQvNWH/4YXZInIumJiSf4p9ga2UdH59BwEN
	 bIrme2KNun6M3pt2EyRR85b/7gClEtsxAiOYAZ7qrlTV79gE8gTpk6FeoGHbHzoUKhMWL
	 toNJ4n8O7rZId6/nid5nJ3MLgsW29HT7pZPPj/ZMkgMP+mX/o7E4i4fT8IgW1hREj+3xi
	 EvX6d9e4I4nFEcaL/Zf7PUUNacTE89zAvRxskaDsbw5XgeQknrN/Vh71Xp86A+XBLjw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796301354;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=8Eljf+wZUodA2gcCysDJ0KIHLrhYsKOo7Or+HAknXMg=;
	b=KLbXQw+AtDn3Vql/rvZ5q97HkvHNy3t6Vlsv3hZPunO6vU8zRI8YHiPubGbeV3nd0a/H
	 INV/oJMW+GDpQMBpUbBi69pRskTMVrwb7JBySoXUfeNXd2fGilqOw+zh3KUK8/26pfb+b
	 BHRgAYXyInsVVgcGpy24haw+q/9ONdkSbmKNCfFifVE+AFq8YU0032WOyWGVIAwKxtYx+
	 b529mELe0RIg6qNNfbG7zzhmGfipgOL7xaZ+oTJWmyk6jhwaNA9TakHVFePXMJuCC2C9i
	 QQHqSlqmXe91ciQWUd4u06nfD0xbqr8odTPZrjFZKX1fV//YmBvY2k/FFPLSxSzaC0A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=fe996L2J;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 680DB606A33E;
	Thu,  3 Dec 2026 12:35:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=fe996L2J
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.48
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796301353;
	b=tGJfz00oOosn5Vye6iG3zBJCqyrWdpad6G3hoVXLx4QhwBqeIpShQ19ZHLtwLDLHUY/X
	 ynN4Bm4njLL0oXa4CaIQloYdcr/Ew4lRYfxjH8t695ex8K9RtRIV6vgmi9EfvHTNnExmZ
	 8XUsxcF0Iir65bnp9S8GEeykV6RH87bOL00NVcC+CzW0wDxeN75Yref7/++i3TCnRuY52
	 DfYsB36atr0CL8p/xlUPK6pW/vzNwJjvUD4YckyP2XTGkKqXkcdrl8k17fp+fLZFOet1i
	 DWPB/Zkz5Dg03bvPyEm+G6Yg+r7tmFzcTWFzDedYjLRbn6hK0mQt0TnqTKL3TYVv0Fg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796301353;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=8Eljf+wZUodA2gcCysDJ0KIHLrhYsKOo7Or+HAknXMg=;
	b=s03nVVubpEBn0Dh7AH8yIXVizE7U0z7S+VmYrjflFXgacN+/4/zY70w0XL3iGqF0HhOG
	 pU6EZK553nPP5dbS+zdC4m1clDMvGS0vrHOzTDbpUFUtJYFBPzLJXt2vxSHe54z7Ljg3m
	 nr8yYxKeRKUsMfuzuFT6dFK5S4Nt8QTPNxWneV9DTYEyHQJChNVMWoTpfdbmtZx2xP7YQ
	 +RnHTHMeSuv7/urba1tdj+cfehm5LNsviUYDF6Y0vHyPwP+oQ/EkA+c9kidzaV6sJdFsQ
	 TZxGjoErKnNLjX/1dfVQZrQGjeGu/FaNXPKZ7BRj8qpzwCJZJzfrneYQJdGHSgf3GUg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=fe996L2J;
	arc=none smtp.remote-ip=209.85.208.48
X-Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DB90606A32C
	for <netdev@vger.kernel.org>; Thu,  3 Dec 2026 12:35:53 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3DB90606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6ba12b00c76so14455238a12.0
        for <netdev@vger.kernel.org>; Thu, 03 Dec 2026 04:35:52 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796301352; x=1796906152; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=8Eljf+wZUodA2gcCysDJ0KIHLrhYsKOo7Or+HAknXMg=;
        b=fe996L2JQfyA0ZgxkL4Z6q1F6nKKqMzhREb94l8WTIYKbjnUoUkjJs6NqcgAVivJ8U
         lfONGpmgf6tkT3Ds763gXgLyDVj9AWjrLRn/AKwKrH96ombrxnnDiFlMZeQxnBQ5akAj
         9M5Wqymaq2MrrkTuuihlcprOy3SpEorbD8hPTM/l3Zec6j5MId6ev4g6tGv+LKoTI7Jr
         82XlwpbxFNfDEyf9ngvRQqWTwXmsfH/p//s5z3RbFm61LD3rZK5uYte3z/X/b7Rek7Ho
         hr17Rpbi+EQ29MAQr7q/DtVpYiH3KSyffPtMuOGSgiGYnTgDDxwApZceTDWXDBnGQZPG
         zZ/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796301352; x=1796906152;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=8Eljf+wZUodA2gcCysDJ0KIHLrhYsKOo7Or+HAknXMg=;
        b=20iAQfFDZCqBWmp2B05YzEX3Bv8wnKywrCgNzYXbZE1FPQBnmC9mf/khbVAFbALO/f
         sdCZQnsYSm5JAzQyYI31CbE20rd52SdC3Jrpl7RrtnvqTrbZU0UX/qxTcNctgz1yGGFY
         YLlEQZRMLO4IMnTdJP/TeVp9f6E3UAsiENooQfaX7bT/+TXI0yJjqpnHxA/cRJaTCL+u
         UM/dOxPRbRgUeiqdrCcHSt0TDwcdd6yg86yq7zJYcsFBrKIVp1wk6nGU6mTSaKiAiqHW
         TSGAi+7hafkBUPiwyrFMcZTT4tataaPfQOQ13Khrobqov7a/6rPIToEf/H4Df+Hf+AxS
         eYpg==
X-Gm-Message-State: APuU4Z/DRulYRpblbebSxcN2DAYC2CgXaUumDrksdynv+2+AuOLu1qHk
	jfP84J4h88LcfJViOF64Im5Q0Zj46Fc1pmFlAGxk/vn5IAT2dB6vsywnh/NN3jp1
X-Gm-Gg: AZFdTZdrx/pg5Rj2lK5MNxYG2XbIUdZCpC9WGemk2aI8AwJkicmBkSBzrb8NUB5XkLR
	kSGYr36kFg2y0WczFGJNK6aIRTPMDLEHnwqSOjBHR3u7wmG8y1IwKbjB/frWCrKBxUu6Z8r84aU
	jGlfDRFkPyARB5av1bSRtVSktF6HoXLA4hITxzR51NvJNyV1vG62414EmNnMfPeZpt4C4SmSyBC
	YXG+3uMJ+4ZbPUTe0FQtXcTwXyAbF8FdwW3uD3IZCncTFzQz5NmqTCngirZW/Po4bQb3YWyH/nX
	qQQx0SFBuaub3exA6wK+ip+hHYPpsvNB9n+B1T0bqniY6bf1KXGtXox5oLx/VzbBciR5b0HBKPB
	qeXdn9sDJ9O6FdxELwafkkjr5ni7HGJyRgVpntAe3uxcHAXZ7DrVdhl/DZFViLXjivN0k4ooiDU
	n6IPDr+s6aln//x3YurJ9SOWHOqKr2RatvjYcg/Gyu4jr5YtA1vQvRUgcUxr02XmovO+u5Zw98t
	GUMLs4LB3H97UTIxD7mCpVfwuMkgp7M3AidG0uPZ9VNSr+6D/2BzXL+9NxT7cJbjm8NNxNuZ8VK
	6Jgfq/Lm0SgRWJbipiZHAkR1y6xKmaXWWEgODA8DkMf4NTnWQyzHC4iD4gNgQyvi3RC1hg0mSAT
	Q
X-Received: by 2002:a05:6402:51d2:b0:6ba:4a8b:96ca with SMTP id 4fb4d7f45d1cf-6ba4a8b9b95mr26400363a12.8.1796301351361;
        Thu, 03 Dec 2026 04:35:51 -0800 (PST)
X-Received: from kordpc.lan ([80.248.138.39])
        by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6bc2a120b10sm3116567a12.9.2026.12.03.04.35.50
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 03 Dec 2026 04:35:50 -0800 (PST)
X-Cc: f.fainelli@gmail.com,
	florian.fainelli@broadcom.com,
	rafal@milecki.pl,
	bcm-kernel-feedback-list@broadcom.com,
	andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <179629488517.3146.16278518529618524423@kernel.org>
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