From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796301353; b=2ghEyc+3myVWDFgQjz46DGApencAefjmjy/fNkbsbtZIN3PxUAc9LrcvpKI+NzhIk7vh Z/oXdCLPHL9+YOX4kHaA5Ae2K2B0oNvt466mj4RTs83zi7OmOhv+7cdVAjaews2lklSMR l+xQSw9XmQRtEiy2vzN9/gCz6Fs9I9P/Omy2cu/UNrvuTKId4XzUc90hx5dXxEQEbF0o1 oDXDpoLMATl7+GBRkmU2V9zL2weNHiKGxQDWky9LV9sJch+mxFXXbP8u9ugHHfrrAKu9K gk1Ll9zsgXa9cpqaI3r4RYYR954J69MExogg6kr3vn6oM2NJ+b4yCffOzR9ORhSBEIA== 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-Forwarded-Encrypted: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=A3B3jgEWM+NHHiu3lLLbUUf2FAovZykEUE7uPVoIPR3MLnJuNO5Q2NgCpOc+z65UfvKX qMd6u1F0J+wWf5+xFtE5cunwXm4bMj/JCgL6UCBm+zb+pe1z7cqKZCgBE/uDIsMxMsHVu sCZRlx1hgBj2HocAqc7nVcLnvW4TXquPOTu9BO/MZQ3aHMcEYQUrgKkfYXu75JI6h3UE4 LOm1VhUQAronpvnpGCNhBs7U62psQrB9i8E3H23I6MO6Tvv7xA/FyCBfUC7kpB00bUohu qMhuYWyyOYNGUw+GcO2ZWg/RprTI57e8XtuH3rfJb5Fth4DIinE33H62gqKSXSRXP5w== 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.46 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 2C93D606A322 for ; Thu, 3 Dec 2026 12:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2C93D606A322 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-f46.google.com with SMTP id 4fb4d7f45d1cf-6ba1e22ff4dso17175171a12.2 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=MV4EDSJdSl3Hge7EBgXOJMhcfQItDNGsXT0MKQRlCLOhOOaFweX6BUy14MW263mSN+ mazIT8QN+EaP7NHsps5zzOpdaXkEoi/2JYu4IbYOpIV0hEGyPjXEgCD9iFs8JScyJ+e7 /RLZ7K86e43+oars9sHQVkEnYnNA/R9i+TyrktXDMheJUG9wwJr0YLMARcIFNTl3g8v5 bdTTvCDzwi8r0Xn05THNhCuPem2I6O2jxRHsXKlEl60Fi5TAIVBKrcUrrZ8hdYMYOZwa WoJCTd1dO865M0gBsXatZNTqVK5QEqC3SO4KkEBcFAwG4Gs57ufKBaVruvaz9N4FIF4b XCfw== X-Forwarded-Encrypted: i=1; AL+hErG8gO103JcvmEVK2yoT4AR9+73nTJ+LjXzEnJvr8PuEKTVQHp0EnUtYO6N3CHaQhMnO7OzFz3zHVtYVPeg=@vger.kernel.org X-Gm-Message-State: APuU4Z/fyS61TOfklq+oU9bFzRKwOQ+uUU9zQam533WC2o3WnkBnXqIw 0b9KlfzVmnYmJ3/LWQSMiAxweZY723rVD0ueOK7joVtSB6ShGkm+oEHY X-Gm-Gg: AZFdTZeEcbj9MAxmDzviLwYyNty8MTlJDPQCS+d7a3C7bHQ8bkIvZp3JdLYzhAP5dJG pv1w+q2ktC3C3LFM83L7zy/CvvEvOcLAy+jfxakgV0FqJhLoZm7F/a53oMtt6KILa0++M2NGLiL +VyK2FqNbulTOqnR/TzdSjzzS4o2EstLg6NjNenM43UkZ82PpMrJaqP+TFf7asdtteDe8t3J+eJ wdbR+vS1kZdOdqr1go7n+KInFvX7gqzAWsawjGpvQopinBzxk7B3pFBvNVMeAL+QL6etpIY6nGt 7qk7B7bEkUJGtXPuFyW1FZC8GUaWPuSHhxWgdRDU3MQDaUinpjaVekKhlnOtIk036cma+X0lCig nF9Zl24l4JLWMAzG3Hh9NlaTVT6+ZT8dFJseg0EJecC9AVLXxXswJtJpYkYyAx8jmTjbkp0TBdb h0IDSaiBQLQUSOnvKDMukDWwRTX7pbRt0XnR0xPXIH5BBEvCw4FeGkNFIn7p/AHQ1xKzPORits5 GXyUsr0wWq7PFSu7xipIXI4weFzNpH/2IQiz7JAkeejmCHkDLVTUCf1dtHcm40dSNU8JeCUEHkm aXrV+nnS5sEdK5OvjdPp9FaXfyA3UFL+tSgzs5NAEolNT/warlEJ/jRuEGhX23IeFBsmL1CGWbj 0 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: linux-kernel@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