From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.48 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== 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== 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 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 ; Thu, 3 Dec 2026 12:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3DB90606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6ba12b00c76so14455238a12.0 for ; Thu, 03 Dec 2026 04:35:52 -0800 (PST) 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) 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) From: Kordian Chmielewski To: netdev@vger.kernel.org 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 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 Message-ID: <20261203123347.205398-1-kudzo51@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <179629488517.3146.16278518529618524423@kernel.org> References: <179629488517.3146.16278518529618524423@kernel.org> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit > [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