Article View: linux.kernel.netdev
Article #3744Re: [PATCH net v4 2/4] net: devmem: detach TX bindings on NETDEV_UNREGISTER
From: Stanislav Fomichev
Date: Thu, 15 Oct 2026 21:34
Date: Thu, 15 Oct 2026 21:34
50 lines
11258 bytes
11258 bytes
On 10/15, Mina Almasry wrote:
> TX devmem bindings (NETDEV_CMD_BIND_TX) have no bound RX queues, so
> mp_dmabuf_devmem_uninstall() never runs when binding->dev or
> binding->vdev unregisters. As a result, binding->dev and binding->vdev
> dangle pointing to freed struct net_device memory, and the dma_buf
> remains attached and mapped after device removal.
>
> Closing the netlink socket after netdev unregistration dereferences the
> freed struct net_device in netdev_nl_sock_priv_destroy():
>
> BUG: unable to handle page fault for address: ffff88824ca9b000
> Oops: Oops: 0000 [#1] SMP KASAN NOPTI
> RIP: 0010:netdev_nl_sock_priv_destroy+0xbd/0x1e0
> Call Trace:
> genl_release+0xf5/0x190
> netlink_release+0xd01/0x18d0
> __sock_release+0xb0/0x270
> sock_close+0x18/0x20
>
> Extend net_devmem_dev_unregister() to TX bindings, including ones
> whose netlink socket is already closed but which TCP retransmits keep
> alive:
> - When binding->dev (the physical DMA-capable device) unregisters,
> clear the binding's NET_DEVMEM_BINDING_LIVE mark and both
> binding->dev and binding->vdev, and unmap the dma_buf under
> binding->lock. No grace period is needed: the device is already
> closed, so nothing hands the DMA addresses to the hardware anymore,
> and concurrent senders only compare against binding->dev.
> - When only binding->vdev (virtual device) unregisters while
> binding->dev lives, only clear binding->vdev so no new TX sends match
> the virtual device while allowing in-flight TX packets on binding->dev
> to finish DMA safely.
>
> Fixes: bd61848900bf ("net: devmem: Implement TX path")
> Fixes: 1abe839b34ae ("net: devmem: support TX over NETMEM_TX_NO_DMA devices")
> Suggested-by: Stanislav Fomichev <sdf@fomichev.me>
> Cc: Kaiyuan Zhang <kaiyuanz@google.com>
> Cc: Bobby Eshleman <bobbyeshleman@meta.com>
> Cc: Tariq Toukan <tariqt@nvidia.com>
> Cc: Kaifeng Wang <kaifengw@google.com>
> Assisted-by: LLM
> Signed-off-by: Mina Almasry <almasrymina@google.com>
> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
> ---
> v4:
> - Detach and unmap TX bindings directly from the xarray walk, without a
> grace period or a second pass (Stanislav).
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Technical Details
Message-ID:
<atFG1wz_26sNn18O@devvm7509.cco0.facebook.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346947-linux-kernel-netdev=dewy.ruReferences:
<20261015163915.1166043-1-almasrymina@google.com> <20261015163915.1166043-3-almasrymina@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346947-linux-kernel-netdev=dewy.ru
From: sdf.kernel@gmail.com (Stanislav Fomichev)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v4 2/4] net: devmem: detach TX bindings on
NETDEV_UNREGISTER
Date: Thu, 15 Oct 2026 14:34:27 -0700
Organization: Usenet Network
Message-ID: <atFG1wz_26sNn18O@devvm7509.cco0.facebook.com>
References: <20261015163915.1166043-1-almasrymina@google.com>
<20261015163915.1166043-3-almasrymina@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
logging-data="2627062"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:W4dw1WTS0NJBX0dJvDvZeiCuuPw= sha256:WmtxV+Zw0YGDi4CMdABTzASnxvtiNdwhAtcYpCZVGto=
sha1:BAhAZf6nxlJmt6bKL5Moa1b/OQE= sha256:gYsk6qkeLm3v5Ga3mqxG+3kep3ahCxLDhV6jpCGRfH4=
Content-Disposition: inline
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 C49DD110390; Fri, 16 Oct 2026 00:36:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.948
X-Spam-Status: No, score=-1.948 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, 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.25,
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 RHiFG1os1bJ5;
Fri, 16 Oct 2026 00:36:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346947-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 1F07A110020; Fri, 16 Oct 2026 00:36:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sea.lore.kernel.org (Postfix) with ESMTP id 3BD103C0F4; Thu, 15 Oct 2026 21:35:03 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A786A530DE4;
Thu, 15 Oct 2026 21:35:00 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rUznG3km"
X-Received: from mail-pz2-f6.google.com (mail-pz2-f6.google.com [74.125.228.6])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8F2E4EF134
for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 21:34:57 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.6
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792100100; cv=none; b=cN3aun4gEjIOBAt8HY+DN6UeaGuYjkf4K5Bvg7PmX02fY6cXrgh6xC+LLduT6zHr7oeHnCOLm0820EMaA41QzIltAQlNjzvRSzuRTtiOooZj9t6GjmTFUUTLqe95Hdk5odyp3IyrPm3olLEC6J0BX+uJEweuHnj1e0EtAO/WzNI=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792100100; c=relaxed/simple;
bh=Fw/5bVG+Kyih8LLkwOIMRNZ+2G0wXkoBUMuhbWqFVUA=;
h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To; b=h8UNxSYMS449vwxVg7D+hTC+liK3T0UUYsWgVQWi4gKYU8SbRtEIbQSy+vtBQ3S+gq8nKrZlD2tcGJ2z6Hcs8fl3w3qydXRaNwUpT8vdsPtuSGOrSAJwF9LEnSByHoSRSVi3FqL+1YDPOO31OgnM+Wdxg6vXYAbWTG3Tkw4/l4o=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rUznG3km; arc=none smtp.client-ip=74.125.228.6
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-pz2-f6.google.com with SMTP id 41be03b00d2f7-cc75f2924abso4014150a12.1
for <netdev@vger.kernel.org>; Thu, 15 Oct 2026 14:34:57 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792100097; x=1792704897; darn=vger.kernel.org;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=KDrSDxpyrWFU5Ei8Mpj2JURPZsUs0EKdCv3HOvYAEoE=;
b=rUznG3kmeeZXjBq+AiRB9o9I9AwWxlPug7UWd4ngLXvaX75V6SxMiyOkvbfsG1luT6
O8VwLa0pkb3NfGvd4uE8AF4KflShhvmnJpSe6KhO/qRM7wBb4cSzW/sF5xzLStLTLgEO
YSV2ilVhADpSv0DoC0NnZpn0SeR7UWZjN6orVCuTcq1vQxCqbUPuUn7KmwrYaknj39Us
4AQkwqXRYTtjftqwhsENCMrINt3V95ZAOVM/D3iOrL7M3gKdZZC3bZ+FzV7IV9U3DsHf
Lw/Zgd/f0Gf/MARgElFM03z9WLFigLhfPjAcDY3RVvihQcagnZD/o8qN0/L4tVBZ4TG4
AY7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792100097; x=1792704897;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=KDrSDxpyrWFU5Ei8Mpj2JURPZsUs0EKdCv3HOvYAEoE=;
b=NH0hynKVF3LIbcgEXqMrvX8YzuceoiNpGEsQDUlxmhKtFicL28sUvgen2ouvTyOiVL
Ws28E3pt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f72 with SMTP id d2e1a72fcca58-897c81b54bfmr17760273b3a.57.1792100097031;
Thu, 15 Oct 2026 14:34:57 -0700 (PDT)
X-Received: from localhost ([2a03:2880:2ff:45::])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-89f579479f8sm157301b3a.38.2026.10.15.14.34.56
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 15 Oct 2026 14:34:56 -0700 (PDT)
X-Cc: Jakub Kicinski <kuba@kernel.org>,
Pavel Begunkov <asml.silence@gmail.com>, David Wei <dw@davidwei.uk>, Stanislav Fomichev <sdf@fomichev.me>,
Taehee Yoo <ap420073@gmail.com>, Paolo Abeni <pabeni@redhat.com>,
Kaiyuan Zhang <kaiyuanz@google.com>, Bobby Eshleman <bobbyeshleman@meta.com>, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>, Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
Sumit Semwal <sumit.semwal@linaro.org>, Christian Kรถnig <christian.koenig@amd.com>,
Dragos Tatulea <dtatulea@nvidia.com>, Nikolay Aleksandrov <razor@blackwall.org>,
Daniel Borkmann <daniel@iogearbox.net>, Tariq Toukan <tariqt@nvidia.com>,
Kaifeng Wang <kaifengw@google.com>
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261015163915.1166043-3-almasrymina@google.com>