Article View: linux.kernel.netdev
Article #16318Re: [PATCH net] tun: delete the flow entries of the moved queue on detach
From: Umang Pokhriyal
Date: Sat, 14 Nov 2026 13:21
Date: Sat, 14 Nov 2026 13:21
19 lines
11840 bytes
11840 bytes
On Sun, 08 Nov 2026 17:02:25 +0000, netdev-bot+sashiko@kernel.org wrote: > Can a concurrent write() still put back an entry that points at the old > index after this delete has run? Yes. On the write() path tun_flow_update() reads tfile->queue_index outside any RCU section, and synchronize_net() does not wait for it. The race predates this patch. Before the patch the entries survived every detach. With it, only a write() that stalls across the synchronize_net() can store the old index again. > There are two possible fixes. One is to read tfile->queue_index and update > e->queue_index under tun->lock. The other is to have > tun_automq_select_queue() fall back to reciprocal_scale() when > e->queue_index >= numqueues. Would either of these work here? The second one covers both sequences and keeps the write() path lockless for a known flow. It would be a separate patch for net-next, since the race is old and has not been seen in practice.
Technical Details
Message-ID:
<20261114132237.70664-1-umangpokhriyall@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363286-linux-kernel-netdev=dewy.ruReferences:
<20261104174240.138491-1-umangpokhriyall@gmail.com> <179415734502.994134.10139593761656069984@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363286-linux-kernel-netdev=dewy.ru
From: umangpokhriyall@gmail.com (Umang Pokhriyal)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] tun: delete the flow entries of the moved queue on detach
Date: Sat, 14 Nov 2026 18:51:50 +0530
Organization: Usenet Network
Message-ID: <20261114132237.70664-1-umangpokhriyall@gmail.com>
References: <20261104174240.138491-1-umangpokhriyall@gmail.com> <179415734502.994134.10139593761656069984@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="1578482"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gsQogUYiuJprH2v7nlLh4uEqlbg= sha256:6huM/OF77TPTdze12AGNWAQ9Gtx30BO7WnczTDF8B0o=
sha1:dkoiCrkMX6b48sJAq+PWeMkxTWo= sha256:BdNlsrgyWiVSLfAInR998rbDEL+efGyoOyboX4lHuxo=
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 6263011481B; Sat, 14 Nov 2026 16:27:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
tests=[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.249,
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 0OjgHgMK_iRi;
Sat, 14 Nov 2026 16:27:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363286-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 EE580114816; Sat, 14 Nov 2026 16:27:35 +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 8E9D832795; Sat, 14 Nov 2026 13:24:56 +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=1794662691;
b=vWj7VL165dbOtFivglGIxvKkfpr+GoFF9qw4OpB5Zt6jAJ7O9S7zD+nS/JOBmKncySgN
wxIhkZd+8aoDr5oDPORq3RGF7zrCl+FPLQqbmHtYGoiE++cKGKK2B7gWxXO8hkAxHbV9q
FPRThewPp0eHGEVIqxH0cy8gilUwQk389g1vXzAgc67I3HE8RVlKDkTQ3YYt/P94ke4dS
WUkuiLSVI3qPYv1Ja+kBDYEtXjegvKkb03I3zgmapIWIPvqszmfW1X6GzHtzda0OdndZ2
CC4vpZwvO+eRv/0rHu+LiKuV05ZR4m1vLzDQpimjXFDSsGefNTTbO08Nw8v6CQKCohg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794662691;
h=X-Original-To:Received: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:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=z+m9K+LmnCAbVYsFIIcGwp/A7IxEWTYNbeU+Gj9SixE=;
b=cxVujU5PaBXTK6MG37wJEe8GFDZmLG0oPoPgOZfMZstIbz7xtO3XPPLlEXlxhKeQqBkL
WwjH0c+kdccGABAchH6D1pmcQLRL5CtZNHcz3jLSuxUst/Stii6ZEnyXJ3/GqqCRHpkMr
vxq74Om6l3p8bwsKPv7HaZMswmNedfg8qWSocIUxG5jSOWBgAOdprK4OFoN0rF+tPTwK6
du3xv+uS2f4LOb0C3Ugh5kwa+n6s7+ju3QK1sjM+FDetKMSGb1cBbzucIjFZOASM5HS7Z
S/IymQATjbD+8y9R3OZKz53yrUhx+KnODBaKubNklTBYQQ+1xanA1FLU8v8G/tRpE7A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=aj9G630q;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
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 BE9CF606A33B;
Sat, 14 Nov 2026 13:24:51 +0000 (UTC)
X-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=aj9G630q
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.52
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794662690;
b=WMGPgDbXX1ThEGGEtb1qKRqmedWLEoy0lWoc6pcPSjNrXIFDab8VT5gRCMjRdn8gA+qE
mH33mebVb6v0wrRkAkt9107D59sQLIRHO4HUmzWw4gLi5UtXWmVARVS0bUNUL1znOHIXy
cTD689lETNq1jAcvWn2k31s//xeB/ONIr3lVDkyljoshLTKKBXKPC9+qZhvdu4PZAazaH
5cCAbTG6a4Dczrl20RlBLWp4eNsuAogihsmH7gqvKD/9Wz+05LALZds5DboYLV6XcLUqj
IfiRdLncxm6qrFtVbGAs7WHRNKn1Gba/fAzW1matidfYy1RkCpusnOLd6FW7fgQA+Zw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794662690;
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=z+m9K+LmnCAbVYsFIIcGwp/A7IxEWTYNbeU+Gj9SixE=;
b=0o1xB/XZryuVddyk+xLuFydoim9Ry/becJe90K+s8H8bjk5rY4ABSQSuLX8DCWQ7y+Nt
pZl3R7lMddes0bYw6u1JXBWyFA3or42yq7NZCidLGRfVf+F3SKO2TWAJDX9X1duB9SzpX
9RpDGnOvyDEsY2cQDjiKsoA+s5r9853tab19970w2Ps2zUjT6xggqiIvhjA0+7bDWqC3j
F1kr2cMj7M0fiPrgzbRvlViZ/FlmWWnKMnajCsMsXERApfRDfyXsQuwO5zn0nzLe2M3xU
TwlbtsmqHBlhEdlLgBqckAxyl0rbvzbh8Rg6ZjsOPV7QUnpE+E1TSz9f7V7c149gZmA==
X-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=aj9G630q;
arc=none smtp.remote-ip=74.125.82.52
X-Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52])
(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 95CA8606A323
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 13:24:50 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 95CA8606A323
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-dl1-f52.google.com with SMTP id a92af1059eb24-1a2af4c8d00so4048864c88.0
for <netdev@vger.kernel.org>; Sat, 14 Nov 2026 05:24:50 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794662690; x=1795267490; 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=z+m9K+LmnCAbVYsFIIcGwp/A7IxEWTYNbeU+Gj9SixE=;
b=aj9G630qkJTfdrV87nhfsX+A5icpTrRm6U228AgbfQKxx9Y9dWaSG0gcoqg/mq6rs8
lmr+r7aiQCymb/GAtPQbAQulrM+V8bJMEHVtrZx95itvPovVlWB+LCdgJ8PScDLmy0NR
put6VH4ZSNYnhm0VCg5uIS3nw/hL2+lGFD3R0WQWDzqgQYnc3GDZJSwqIOVwj1s+K/Sy
CohvgcB2BiBMhWiyyJ7T85Qljdy5xjhjJuUvlZRkyIj/zDSgsGll7YBlByCcGLZvNYC2
BZpJBxUnfWv/lEe9RysxqYVKEhMVeNHDBkbGAj54dmqfoHAgwjeNxkwdD2UeUH/z2+dE
+iFg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794662690; x=1795267490;
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=z+m9K+LmnCAbVYsFIIcGwp/A7IxEWTYNbeU+Gj9SixE=;
b=uGUa0ylezR84Ny1C6mmpDzKjpor05gSnKRVY7VkzdNNKoDQl2FVS957zDpoWqYZJbc
iWtaO6zFPwFOZRFJ4dKTKGpZjNHCiS7rno2s84pGDMJ84O8cdfaPsJ+IN6aYEbIpZPvS
fwETda6cK/I+GUpg9DI7byOV7Tg2HzUikZ5/01AmQ/HzgWAmgriI0gY9ZICWpHs7+5iT
yGSCG2Av6ACBWyp/PyBQx39WseJEehAaH9yPqk1IGzRp204m99owpYv3l2FcYdfOCZIN
1O5aJcYPUUWwXpexzfs9VdyYzzIc49+gPAHcbka0Y+djrIdRnGE9mzOzoSJoXx7/Pqcx
tKqw==
X-Gm-Message-State: APuU4Z913IsqjMyhGe/FNcdu9alp91LAOeGHyeNNOzqxYDDWju+sxCnd
rSP1BE1k1Z7uIzh4cU/WpyCVO/+cFz9Csxzv3FGzXPk9WCLJ+79jhhnu
X-Gm-Gg: AYBFou1z0xvaUUTqGxx9jc7x5i63oeZtcf1Tpw1FiHLroDSjSSM4o9C2dt/0qEerTsE
PmWu+84N87eHAjJNR/LSeyJpvytS2i4uy3PdGu+ehixdnhOP+MDrf323usNxrSne9GZVHasl6Q+
KDGITQvu9frMzzVg0pKRkbtc4AmyhBXYJmU/PKMmTgF/S0bSMpkHJ1Hfs2f4UbIB73lr6Jrs6zE
hdMzrc/slWHDLNUcr3082tMpGSMO1exISIMvilPhLo/MpE913cYqjDaIL8tB4gs0QrOb3wWgkqt
bNtoTy1gracIZtCvvzBxekTAgQhQhNhgz6lLPolDYnSpictwXRalFuGr1+HdoYVBhZMwRUZ8HBs
VgqvhYHRuRFE8fctyoyjfOSWM3fbP+RkNDNsDvBngO9KGxi2KpNAXfEd+4nd3O/YNDP3p3DOPKV
n9zkyjapcoanRcsithbk+7yYxgQRTKSEBRLggiSy11icBCvnwNAmtfb/8OZriuEdOzQ0hv7yKEc
Kb1IScXQK/4Yfs/uW7lu8dzuAiuYfmc5B7pRExIg0+sB3cSEcrjcgcwZ16o7G7GA4lLl2/ARz/M
ZRaN2tbyoj9O+X2VST1TDpvR8tQPsC1LNcghz7y9EMGM26Qjot6lrg==
X-Received: by 2002:a05:701b:2706:b0:1b5:126c:eb88 with SMTP id a92af1059eb24-1b5126cec12mr2504907c88.45.1794662689598;
Sat, 14 Nov 2026 05:24:49 -0800 (PST)
X-Received: from umang-Inspiron-3501 ([2401:4900:1c60:38c8:74f6:e2c1:4674:3e44])
by smtp.gmail.com with ESMTPSA id 5a478bee46e88-37955f01d68sm16312312eec.17.2026.11.14.05.24.45
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 14 Nov 2026 05:24:49 -0800 (PST)
X-Cc: netdev@vger.kernel.org,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Jason Wang <jasowangio@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <179415734502.994134.10139593761656069984@kernel.org>
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