๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21365

Re: [PATCH net-next v8 1/3] net: ethernet: mtk_eth_soc: reset dma_addr

#21365
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 23:15
62 lines
10286 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message of "net: ethernet: mtk_eth_soc: reset
  dma_addr" describes the mechanism correctly but undersells the impact.

--

net: ethernet: mtk_eth_soc: reset dma_addr

This patch resets dma_addr to DMA_MAPPING_ERROR at the start of every
iteration of the mtk_poll_rx() loop. A descriptor that goes to
release_desc without a new mapping then keeps its own high address
bits in rxd2, instead of picking up the previous descriptor's bits.

> With
> MTK_36BIT_DMA and DRAM above 4 GiB the hardware then DMAs the next
> frame to an address that is neither buffer, and the driver passes the
> stale contents of the untouched buffer up the stack.

[Severity: Low]
The code change looks correct. Could the commit message say more plainly
what this means in practice?

Before this patch, once one descriptor had been refilled, a later
descriptor that jumped to release_desc kept its own low bits in rxd1.
Its rxd2 was then rebuilt from the previous descriptor's mapping:

drivers/net/ethernet/mediatek/mtk_eth_soc.c:mtk_poll_rx() {
    ...
release_desc:
	if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
		if (unlikely(dma_addr == DMA_MAPPING_ERROR))
			addr64 = FIELD_GET(RX_DMA_ADDR64_MASK,
					   rxd->rxd2);
		else
			addr64 = RX_DMA_PREP_ADDR64(dma_addr);
	}
    ...
		rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size) | addr64;
    ...
}

The release paths are: no netdev for the source port, MTK_RESETTING
set, or mtk_page_pool_get_buff()/napi_alloc_frag() failing under
GFP_ATOMIC.

In that case the NIC writes the next received frame, up to
ring->buf_size bytes, to (prev_hi << 32) | cur_lo. The driver does not
own that memory. So ordinary inbound traffic can cause the device to
silently corrupt arbitrary kernel memory.

The current wording ("an address that is neither buffer") describes
the mechanism, but it never calls this memory corruption. Would it
help stable and security triage to state that directly?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/patch-51fa5ed3bc801edb3f29b61ca7888382%40loljews.com
Technical Details
Message-ID: <179547570565.3135.18239991807635277619@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-369833-linux-kernel-netdev=dewy.ru
References: <patch-154d2fe52d9ef9bfc85e603784552187@loljews.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-369833-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v8 1/3] net: ethernet: mtk_eth_soc: reset dma_addr
Date: Mon, 23 Nov 2026 23:15:05 +0000
Organization: Usenet Network
Message-ID: <179547570565.3135.18239991807635277619@kernel.org>
References: <patch-154d2fe52d9ef9bfc85e603784552187@loljews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4005652"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sQGMFONCu3C3cy/FAk4/SmTIl3g= sha256:cn0kQDwZgJeeOCmBziLCZNT4ZdLnN6lT7yQeNQ7XiBY=
	sha1:0TYTCrktyRFs7zri6eQwvPpeFUw= sha256:Xyebc56vd+jERGKcFWBT3bQ4JZMxeKCnPio+mqmgYU8=
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 42DE4125DCA; Tue, 24 Nov 2026 02:15:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 WrH-KRTekxoy;
	Tue, 24 Nov 2026 02:15:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369833-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 548BE125DC9; Tue, 24 Nov 2026 02:15:17 +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 2560D36FDE; Mon, 23 Nov 2026 23:15:09 +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=1795475708;
	b=JjPAYoZnGjybUmF2qw8waCX4pGBEzKvp8bHxEqhdMuxAkeYqNEtobrZIxKchZMkf36gG
	 t47rb7Qt8MdQMpiOp05biMGJM/WZcQ2lNXSZUYMenveg74emtdkrrqFQFozCvwwcLYruX
	 ooP3UIneQxKO05WIwbPVwR5eM9pZdCA9nqEPQ15quBl0fQSLIjr0r42cIbnlqdLsSQbfy
	 pGt8b4o/aK0UtuRkmjvBiA5TwiisHpdMPG2DXxSdWZ5LUHamdpAyt0pyv8cnnnOvzZqNJ
	 LilturGkIK1Tq3ON7qyly/TiwNIreLHoQkcDroXPq3gjFpLpCwDo64dhrpxaq16bIgA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795475708;
	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=hKLSWJdH/cW/Tz03CBh7+GtUNubuHi+KzzGqMktxs8M=;
	b=aRDUwU7yQYhL9EXaXoiXnHWeQ3EnfWn9K9URVNE2qqIvrhn7ZJ0kJCEjC7J3+6AOLcMD
	 TrOAzDE5i1OgqyeLSullybHfHddNS8Th2z6RFSqd5cJpBOCYyXrhdGFcZHcrZNT93Hbah
	 dvFVG/y55PjNKaBqSZVL9GNhZpUNnRnfgVvP2fJhhfHo9iFgyHDoBoauXacA2stiFtCIu
	 0Hm2GuxWTyUMz/Rw3M7tykzrmhlQjl6LW7xLBBPve/fBK/sJ+z9FTlBImHWVoMq+0lWf/
	 mXVVpvkiYYqC6gQCm5cQmo3MV4ZVVThV09GMF/HgquqYPKUutLksN0EjTCd7t+rZNTw==
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=kVlt9Hv1;
	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 50E8A606A683;
	Mon, 23 Nov 2026 23:15:08 +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=kVlt9Hv1
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=1795475707;
	b=3wzUBR/5e+wecoOn6zYdfqXHXNHAArzfIsGowL22rQJf4M7cLoFCQz1JhqUvJyL8zXAP
	 +faKsl7ALZuXbwZyTmuVVQn86ST9h4RAL+BMlTJOIV950KZCzxtSHOl8/jX46pYJmPpCa
	 UNmcvuPpBtO+1WrDfsOgn6zZCfof7G1SrvzLxMT1IZiWBY7dgJ7RqzwC3X+QpFeEJmdtu
	 h9dZL1aG5/Hth1vaRHcCFqmEvh1cxK3b4w9C87Isv1X/DAezz5tEEMpQ+7NXNoUBcLf+F
	 H61HwBOmJF8/FzMIfnRWGows6KB0eQroMajuFb3atLkiqWL7iX+McnSu5enhjQCl5mA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795475707;
	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=hKLSWJdH/cW/Tz03CBh7+GtUNubuHi+KzzGqMktxs8M=;
	b=EXuf+6gUO/q/z1N+V5nJ0V4p+fUnyhXQM7aLh8/tVUMs5E4RHEQ5rI4AralsvrVBux/D
	 U3TsnkEUWo6diRQW8/kJ+1s3eVmZT5Vo/fbxKXCgday3cnZKCLbUCN5oPLlHrEJQ5o2by
	 pjinIuaF4z7DuIRaKbCI/pIh6CHHrprMRjW4p7F5xbUORNEBebE2J9Xy/2B/UwDXQpWAQ
	 DPtJUbFB+xR/oPz7FH8dGqF2h1EV4MxA/0xWMKrsMejlX/mmeRnm/X0Yz975kmnPQpbL8
	 mhMVROU2dQKp1UI9PzEm+Toy0xSB17YcoKqcq+jEcmTvB+JcxfBPqjs2wfKYHNmFedg==
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=kVlt9Hv1;
	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 71814606A685;
	Mon, 23 Nov 2026 23:15:07 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A87A1F000D0;
	Mon, 23 Nov 2026 23:15:06 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795475707;
	bh=hKLSWJdH/cW/Tz03CBh7+GtUNubuHi+KzzGqMktxs8M=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=kVlt9Hv1p9OYTI9HUT/B6bbWk9du33RzDunq243H7OkOeuQmYLJA7DdiDVw7mi1ms
	 KRpo1BtqOvGDUx17syAhEV0GQrd4wFO3MVnC4lXZKuNsOxstDQYzjZkjDhzawG6bwu
	 V77kOl8FPXJ/fNXPAnHbKv0OIRmuZczumgo1veCxcIbgoJ2m4jISrGmSXYMaNVJMYA
	 tfJfan2dC+IO3CRjvaigPSfTd+rjuI+ikGVHDjm2NepJ6XMw3cTrVbaRRJxi2HSwGs
	 Kc9LXCsi1kcvaGPJRugTPcFADZAck5aZPMek/MVqsQxCKvqtP2bhNKTqRF6JFrhIwn
	 2xD/zyWSz/MAw==
X-Cc: netdev@vger.kernel.org, nbd@nbd.name, lorenzo@kernel.org,
 andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com,
 angelogioacchino.delregno@collabora.com, linux@armlinux.org.uk,
 daniel@makrotopia.org, mason-cw.chang@mediatek.com, frank-w@public-files.de,
 linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org,
 linux-kernel@vger.kernel.org
X-In-Reply-To: <patch-154d2fe52d9ef9bfc85e603784552187@loljews.com>
X-sashiko-severity: Low
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