Article View: linux.kernel.netdev
Article #18300[PATCH net-next v2 1/5] inet: frags: annotate data-races around fqdir->timeout and fqdir->max_dist
From: Jiayuan Chen
Date: Wed, 18 Nov 2026 04:51
Date: Wed, 18 Nov 2026 04:51
58 lines
10945 bytes
10945 bytes
fqdir->timeout and fqdir->max_dist are read without any lock while their
sysctl handlers update them with WRITE_ONCE(). Add READ_ONCE() to the
readers.
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Simon Horman <horms@kernel.org>
---
net/ipv4/inet_fragment.c | 2 +-
net/ipv4/ip_fragment.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index f330d0a398233..8143162eb9f53 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -416,7 +416,7 @@ static struct inet_frag_queue *inet_frag_create(struct fqdir *fqdir,
inet_frag_putn(q, 2);
return NULL;
}
- mod_timer(&q->timer, jiffies + fqdir->timeout);
+ mod_timer(&q->timer, jiffies + READ_ONCE(fqdir->timeout));
spin_unlock_bh(&q->lock);
return q;
}
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index ef7fd61284a3f..5ac69d716da2a 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -89,7 +89,7 @@ static void ip4_frag_init(struct inet_frag_queue *q, const void *a)
q->key.v4 = *key;
qp->ecn = 0;
- if (q->fqdir->max_dist) {
+ if (READ_ONCE(q->fqdir->max_dist)) {
rcu_read_lock();
p = inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif);
if (p && !refcount_inc_not_zero(&p->refcnt))
@@ -220,7 +220,7 @@ static struct ipq *ip_find(struct net *net, struct iphdr *iph,
static int ip_frag_too_far(struct ipq *qp)
{
struct inet_peer *peer = qp->peer;
- unsigned int max = qp->q.fqdir->max_dist;
+ unsigned int max = READ_ONCE(qp->q.fqdir->max_dist);
unsigned int start, end;
int rc;
@@ -242,7 +242,7 @@ static int ip_frag_too_far(struct ipq *qp)
static int ip_frag_reinit(struct ipq *qp)
{
- if (!mod_timer_pending(&qp->q.timer, jiffies + qp->q.fqdir->timeout))
+ if (!mod_timer_pending(&qp->q.timer, jiffies + READ_ONCE(qp->q.fqdir->timeout)))
return -ETIMEDOUT;
inet_frag_queue_flush(&qp->q, SKB_DROP_REASON_FRAG_TOO_FAR);
--
2.43.0
Technical Details
Message-ID:
<20261118045137.174026-2-jiayuan.chen@linux.dev>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365865-linux-kernel-netdev=dewy.ruReferences:
<20261118045137.174026-1-jiayuan.chen@linux.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feeder4.usenet.farm!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365865-linux-kernel-netdev=dewy.ru From: jiayuan.chen@linux.dev (Jiayuan Chen) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v2 1/5] inet: frags: annotate data-races around fqdir->timeout and fqdir->max_dist Date: Wed, 18 Nov 2026 12:51:16 +0800 Organization: Usenet Network Message-ID: <20261118045137.174026-2-jiayuan.chen@linux.dev> References: <20261118045137.174026-1-jiayuan.chen@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2506503"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:C3iD1kgEo7iJ8c5da3ioAUl+PIk= sha256:hkAJjuQVxvLfqb88N1EEv3gaLicMK7+20x3XjVNjJfc= sha1:Vb/WxQZNCqS+DFn7LTAtnAHzsOM= sha256:Ar+5QvvLaAs1xCc44aM24XBPwsngzQiWf4svcDEi2vg= 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 0769111519F; Wed, 18 Nov 2026 07:52:30 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.051 X-Spam-Status: No, score=-2.051 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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HK_RANDOM_FROM=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 (1024-bit key) header.d=linux.dev 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 zggqJyyFpAEy; Wed, 18 Nov 2026 07:52:26 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365865-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 16FA511519E; Wed, 18 Nov 2026 07:52:18 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 0FB8345853; Wed, 18 Nov 2026 04:52:17 +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=1794977535; b=L8ebTKwD3pQCdAKTl9P8003tr2hqAazd46r/nI0q8NcjcL5t0ElPV71vcRBRCJOYdM9u lZMZdI1lgv59zWZ/FEyXEA2+rHXtFIm0YrNpNaT1aGrZ2aqfHjJj0Scgzi9JsaP5OvoGV x+1vUMfQPG5dcvTCa+iL1PNDZ+dAoCZE4X2ZJqd4089tCxYgTtiT8rzezEYP32+PhCzfP vl5SHx0FaYzgB93TTPb7Nrg5h/w94oDz4jkbNEsHfatBR4fwUZJCo5uYrjsUAzVqeBD6i QLUu0GhBZheJS0OwC///+QP67T4PxyLmJA13WqZsjgwkNhqdkmdnkELSsr5cB7369rA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794977535; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow: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=D4Glb/phafOO2J4NO7289AZtRKHSGknHG2wh1OwjCi4=; b=iLyiKgcuKNuaCThH7xKHlq7sIa2+hkvgpoBGqoTlX5MrT/MPBnssvrKogELUrvjRuRce 3AHt91x5U4kJ3RZGqhe3dJ5msaJT7DfV4H90D4VbCU+jPujJTXrcXx70EgyCfph0txE4I ZVnDKAOQHs5qjC5+k/5YQP699dJul9xi0KzOyqVXKJwvSb4lK5h7K5ns0fw+IqNqnUhfP upWqOyRHFxxWWgD49Q/04KLwv6hbHZ2BRMt3eAW7fpeMGjLGZOjXp1BeJJQ88VwVX+yEj YO9YfnTGDE8OGWmgvO8j5v+IhHLVf/ZiIHPYs6cBWZtVjrFfVhQsXg4rRCQ5yhzAowg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=qHk+1IWp; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 7118C606A337; Wed, 18 Nov 2026 04:52:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=qHk+1IWp X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.68 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794977534; b=NVGVydqgMbBYV6clfY99PCY4boXwRjrY8lSLlbKI2r2geOkyFyf9zOZo1d/cTk1S5Q7C mlmP1U6awuAiCa5V/bj0+0IAoIk+xQZgQMLr22UMBqh7dNMPAdYlAvfU2pDHH1Rkz3eUc dG+k+5MVkXgw6eivEM1ooqcHlWE0IBXRBfDdETevI6OInU5T3xwPfhWK5ozufTQPHPUHM e31p0RXsxTgmPcSQymwz8juVI1XJv2nnvcqkWtnjBfpAeqtFRHDD7XwT/l0QXml71OoLr awIwewbRTGyA0F/ywANdXfb/q7f1p/p2hk9PLg8+UEfeU2965XkwU3NTGAKy7FoOfWA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794977534; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=D4Glb/phafOO2J4NO7289AZtRKHSGknHG2wh1OwjCi4=; b=y09Nk/TNAVtYD47KFnCxXXNCDYW/VEZgGlUTwdBocJjw/JVqd0WQzN4fO26SNDyWKRat 3aj5jfZYkW5RYCnQvitQZBta7Xec9blNjShf0hpx32FOfEgUnLeYT1h7kQaPzFyr2N3gJ 3jjqG9DMvNtr9gsLtJQWUDsxjybSbS/hsUg/6Dyuhbqa4bnEyCnx7JOiL/QSEonZS7zVR KQ3oJLn5pPoUDOGE1sXcjfBO9VUmcxxHM9ARmzLjc0DVW9oVH/fKjGUmlCw4Q95L3J4Y7 A3WqRWAQLChZXpC4mIjNE2PDkGWy+UoZtptLlqsl2UaxRvZZfmB0UDOGkCI9tXCGWtQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=qHk+1IWp; arc=none smtp.remote-ip=91.218.175.68 X-Received: from mta0.migadu.com (out-68.mta0.migadu.com [91.218.175.68]) (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 F1D85606A332 for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 04:52:13 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1D85606A332 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=D3DeV3YkG5u10TKSbuUfjvJgZyIgkf+zdkPJkso3qVI=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794977531; v=1; x=1795582331; b=qHk+1IWpFiYNCgRhRAelEnhQmvIkckZ8ZqfVdS5K2Vt0WdBoMSxfrgCpCETdXgMTlCFJ0euE oQS4GhrheBzYA+ru98V59USQr8qrUSQaao1SjIlasYWaXrR7fS9HSMS+SvLMLKrK7mQMQTxpEjO BWysdS1ye+jAjxR6ZOTWVllg= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id 9116fc7c9e291cd0; Wed, 18 Nov 2026 04:52:10 +0000 X-Mizu-Trace-ID: 9116fc7c9e291cd0 X-Migadu-Flow: FLOW_OUT X-Cc: Jiayuan Chen <jiayuan.chen@linux.dev>, Simon Horman <horms@kernel.org>, David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthieu Baerts <matttbe@kernel.org>, Mat Martineau <martineau@kernel.org>, Geliang Tang <geliang@kernel.org>, Allison Henderson <achender@kernel.org>, "D. Wythe" <alibuda@linux.alibaba.com>, Dust Li <dust.li@linux.alibaba.com>, Sidraya Jayagond <sidraya@linux.ibm.com>, Mahanta Jambigi <mjambigi@linux.ibm.com>, Tony Lu <tonylu@linux.alibaba.com>, Wen Gu <guwen@linux.alibaba.com>, linux-kernel@vger.kernel.org, mptcp@lists.linux.dev, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-s390@vger.kernel.org X-Mailer: git-send-email 2.43.0 X-In-Reply-To: <20261118045137.174026-1-jiayuan.chen@linux.dev> 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 X-Received-Bytes: 10608