๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20721

Re: [PATCH net-next v4 6/7] net: devmem: resolve physical map_dev for leased RX bindings

#20721
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 04:59
71 lines
11123 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 for "net: devmem: resolve physical map_dev for
  leased RX bindings" describes a use-after-free and has no Fixes: tag.

--

net: devmem: resolve physical map_dev for leased RX bindings

This commit makes netdev_nl_get_dma_dev() return the physical backing
netdev when an RX queue is leased. That netdev is used as map_dev for
net_devmem_bind_dmabuf() and is locked around the call. With map_dev now
always the physical DMA device, the commit drops the
!netif_is_queue_leasee(dev) guard in net_devmem_dev_unregister(), so
leased RX bindings get unmapped when the physical netdev unregisters.

> Previously, netdev_nl_bind_rx_doit() passed netdev as both map_dev and
> bind_dev to net_devmem_bind_dmabuf(), so leased RX bindings stored the
> virtual netdev in binding->map_dev without tracking the physical backing
> netdev at all. When the physical backing netdev unregistered while a
> leased RX binding was active, net_devmem_dev_unregister() did not match
> the physical netdev and mp_dmabuf_devmem_uninstall() on the virtual
> queue skipped unmapping because rxq->lease was set, leaving the dmabuf
> attachment mapped against the freed physical dma_dev until
> __net_devmem_dmabuf_binding_free() triggered a use-after-free in
> dma_unmap_sg_attrs().

[ ... ]

> Suggested-by: Stanislav Fomichev <sdf@fomichev.me>
> Signed-off-by: Mina Almasry <almasrymina@google.com>

[Severity: Low]
Should this commit carry Fixes: tags? The use-after-free described above
seems to come from two earlier commits together.

The first is 222b5566a02d ("net: Proxy netdev_queue_get_dma_dev for leased
queues"). It made devmem bind-rx possible on a virtual leasee such as
netkit, but netdev_nl_bind_rx_doit() still passed the virtual netdev as
both map_dev and bind_dev.

The second is c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on
queue uninstall"). It added the guard in net_devmem_dev_unregister() that
this patch removes:

    if (!netif_is_queue_leasee(dev))
        net_devmem_dmabuf_binding_unmap(binding);

c4466d2c3e77 fixed the non-leased form of the same use-after-free and has
two Fixes: tags. Without a tag here, could stable trees that contain both
commits keep the leased form unfixed? For example:

Fixes: 222b5566a02d ("net: Proxy netdev_queue_get_dma_dev for leased queues")
Fixes: c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on queue uninstall")

The fix also depends on earlier patches in this series that the commit
message doesn't mention. netif_lease_valid() comes from "net: guard memory
provider RX queue open and close on unregister". bind_dev is only always
populated after "net: devmem: always populate bind_dev and detach both
devices on unregister".

If this commit were backported alone, wouldn't it fail to build or behave
differently? Could the commit message list these dependencies?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120045918.1239746-1-almasrymina%40google.com
Technical Details
Message-ID: <179540996833.3135.12827693293026536068@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369039-linux-kernel-netdev=dewy.ru
References: <20261120045918.1239746-7-almasrymina@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369039-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 6/7] net: devmem: resolve physical map_dev for
 leased RX bindings
Date: Mon, 23 Nov 2026 04:59:28 +0000
Organization: Usenet Network
Message-ID: <179540996833.3135.12827693293026536068@kernel.org>
References: <20261120045918.1239746-7-almasrymina@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3793543"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fz9hfCcyyEPVQkVRIq3iDU42qEM= sha256:5cFqW74rQUm3Bd2stgHhXCeUzWk1Y39LNU3OYxqi9Fs=
	sha1:dZbkmRh4Jp937z3oqbNU2LQDGR8= sha256:tcvp5AjXhaVhn4rgS+zSvmoBzxCvS0Z6rC1xK13rGXY=
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 5679B125D8E; Mon, 23 Nov 2026 07:59:54 +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 poGf12Xk1ySa;
	Mon, 23 Nov 2026 07:59:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369039-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 532A2125D89; Mon, 23 Nov 2026 07:59:41 +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 3550B2CCA6; Mon, 23 Nov 2026 04:59:31 +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=1795409971;
	b=Jiz1bC1w9BH9ShboOLn78OOPimFMuAz8+17klXHVgJRFknU3nxZD2iqo1G6MbXI/yq0s
	 DIBHLsgv/+kdu3mYjXDk5zujKuapfiVi3vfVyTefxWxjLbpWQKZZnz9uQjdjhnT1ra33C
	 DJh4zHi3ewAHt2QzBcTH9sPYw/SiAU0m3dYkTxAxG5RzEs0l0abLuizplinpfL+ZEy8nP
	 fRGdVxZ9hTmBMNQ557C9f6wmQKZL05KlCjh06q5iIw3VX/oHr/VLvUQa3ZHqkXIbTYG8o
	 jKFpWYmBIG/5oBOMp1bvmtjSuYp2R0nZ1is41nmuYSwBhJdy2ymhOB8Wc2acbFFrJjg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795409971;
	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=1U2qKwXOycH72CjwahmU01vcSa577mKU1ZxaRp8GTkc=;
	b=SFTv+eacO4d+BokkCy1ctFJi43R9mHMKy7ugjEJMJZ1+IZABVzt+5JoUwMVjeSkdVaYW
	 AqlWvgUTSqcg9LAE8p8/pIhteziToe9O22mdl5UqqtqC8N7wTdvuKbO2FO0DgEAlifobr
	 rRRgNpyoowNVF6EBwA27b+mfCAS96dOXhcYaPOnzYUqIn5ycmCMeEe9cSvmc2MoA/nNCw
	 S0PgeA2pX+mW6J1i3vr1OJTmB+erM0uiSgyr8HGNhMXWO34dhPGL2wTyz9SXmVNhk7l4N
	 tzKeAoWtVaxsm2F/1HwsKsfIUAKlPYEQ/YhRIbjFgIxLZFDy+GnQxtN9zGlNiOa0Sqg==
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=hnIwpHbv;
	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 E2ED3606A334;
	Mon, 23 Nov 2026 04:59:30 +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=hnIwpHbv
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=1795409970;
	b=yd8+H+n5MBEIXrBzyqPNYXl8KMprVLb07nXOsC1HhFA7jV0NzH8gtdAn91lb/MQsBKbt
	 sBXrb5WbYCIXyQCkaXE9AMbfMSfVylrjcqZARrHx0tiDYA+y8EPXDrFqjkI46YaH1LPjq
	 mhOnivoh6irzfDWMSoSYsLAjHxpRJtndyxHzcNXaGKAcVeKCfMJ3wNXvubBEaApOaTZq6
	 WQEuu8CyB4x+RLsFVaP0JsCOKj/+QRUZAvGux/r2a9fv4sIRPCZ5OfZ7i9K9o9MdzpVrf
	 PWue2Y+tqEx8tWMHf79BOLV/pwtBnXFciDRuJydY/4fdRQ4raqQmYRGXqankWLHlC9A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795409970;
	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=1U2qKwXOycH72CjwahmU01vcSa577mKU1ZxaRp8GTkc=;
	b=4XHZzQRX7WYMJNGbSYmo8jWKQP3PbDFX/3oYq3nWZUbRZ1LqZsanYf2ZisyiYzsY+R7N
	 MMfqCier8Mgskjn43yLAZlv6zLb0phuYex4UQ4yCpj5zfKn/I8+rubwl9DaKA8+IDhdh4
	 Zk8mEA+1Us7lUJcKsJgwsYMzt5Shu39x88IogM7s5S5hbesxcEbJmB22D+19j7KURmrnW
	 zJTaw4CvnYR3UdHXl8JWExcbL4wMVvsWfv2aX7UJvhWJq/sPadRm1h+r/tZDUElDkBZ52
	 +Q3oQYcI5Kort4SbkjeIZ4Ga9UttH1arHq5/W5YM+QN84dfFd9zWKRgGqdmhJZC3sSw==
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=hnIwpHbv;
	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 0CD76606A31E;
	Mon, 23 Nov 2026 04:59:29 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B652D1F000EF;
	Mon, 23 Nov 2026 04:59:28 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795409969;
	bh=1U2qKwXOycH72CjwahmU01vcSa577mKU1ZxaRp8GTkc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=hnIwpHbvHzpVcwFrad7ro6tQJJ++RxjZrEEvd2QM5duiW6MS0lcbDyA5fIqP4rLdS
	 JEyePJ0BvQe18TcvXDslB+50V6HCvtFsElvuJQJnUv/72tiPiH6VN6J+JW7uIvlQD2
	 Ilga4cIbYkxz22Jhw5XU7yoL+Z3cHXKUfMzx8/oVbf3OOtefwJ1vzWpMlsmYJ2aKXG
	 E61aaM65sSbqAovSqxUeHUkd3yxqteefWv2EQdylMUjLFQQ3cp2q0ZyeYmZ71XjhyG
	 RCcwDp6tZZ1u6h4vKHg3cAXyH628tPsgEJumjY/XBPOPpRm/sGHJ26lWKvb8yOZI8O
	 sBGja96oO3Psg==
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org,
 linux-kselftest@vger.kernel.org, bestswngs@gmail.com, daniel@iogearbox.net,
 razor@blackwall.org, dw@davidwei.uk, sdf.kernel@gmail.com,
 bobbyeshleman@meta.com, dtatulea@nvidia.com
X-In-Reply-To: <20261120045918.1239746-7-almasrymina@google.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