Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1849772lql; Wed, 13 Mar 2024 09:46:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW02zwahnR+LbVq4PojO0P0EEKhTIzgAfn3DOITkLu/061xC/JRMg4foKzU2ciZPLdDLpHcAX7OsfL/4aNzMW9oixxTUuWP6VwBB9Y6tA== X-Google-Smtp-Source: AGHT+IEfXJXrzMfXXNUfQjmOvUBa4VQc46+BZQfsWh58WtcmqnJby79ww9EcyM3VUGs3SGNCaDqh X-Received: by 2002:a17:902:b413:b0:1db:4941:f703 with SMTP id x19-20020a170902b41300b001db4941f703mr3570714plr.15.1710348388057; Wed, 13 Mar 2024 09:46:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710348388; cv=pass; d=google.com; s=arc-20160816; b=rOnWz6YDvDrPuVa3bLu3vfoJkgJ5ntgBVkQDye810hshX8h4R1YVkAx+79ycy9lKqQ WCSrzFP6etYeHtrZIBuChMdVvxANJ+uf2GCNPgBmw3pWToPu/MwFjYf+WkS/HOUCYODq FjTw41cOTb95nfBZTkTDSzNGVsBY/PtLo5InnCMEVE70fE1hQ8WpeBOPdEzg8pFAjCyA LeylkJLSbKZuilmZOC0uxP/VLfG/ZulvyQeKUxsj8ZeyuWevZU9tS70cZQSPfG508N2N w3OI9xr8Mjza6hGA95mP2pD4Lt6F5AXDR9+svU3go2EhALCvSg6rV3yJm/cXOIycV6yl aWBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=yo/J5Mr7FcWg11bWwLta4jYqKbDS21efzXTxDy6N4lI=; fh=UDybChT8th3KBBN/dtQlnvIe4LqqY5GN+FXyISH2BnE=; b=wprQvllG4tdcJcxSzc2tj/v4GriiLa6EL8JO6UNvXenu7AQizBxi3o9YaVluy+J5wE I4xKSPGj8mlYDcShgIwRjdvjrvjRTCpWkFDTaq1+BJADaQOdIDwhzXsriG8rqF73sG0Z ziFCmcSy/S9AxvLMnxNS+bSjIQBjPVViEUUan5EyzDxOQGwztKEJYu5qAL80dM/3XTT4 AafCraROHJ4J4Kxl3gnQhytt6zLWDD44mDFMK9NJqQRsTnIsjc2n3xM7Tu3AM2+QaVJf cKXy3PBlI+KAtX5oI6FM+vsIlFG1LcBxgNc/X+MVANdxztgu7cffoE7tnzxc0i9aITm3 HHAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mf7Ha07Z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101783-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p16-20020a1709027ed000b001dd779ed4c4si9059751plb.218.2024.03.13.09.46.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101783-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mf7Ha07Z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101783-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101783-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5336028749B for ; Wed, 13 Mar 2024 16:43:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 071BF634E9; Wed, 13 Mar 2024 16:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mf7Ha07Z" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13C02633EF; Wed, 13 Mar 2024 16:33:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347613; cv=none; b=XcZH3AcntBCnbqLXcYhxDwDRwgRPb+Hx9XtXwAnBUexEH/S7N+FG/nncCEW7KaQZW4O16j21Zs2ibubeESbAGYJuo28O1rRzhBGBVQq2RlJWhmm6iByrIMyF3QBgLM/ej60MdZqIJ9B8ngOSqvST8lEbCqSCydS3Ha7XW+pAdcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347613; c=relaxed/simple; bh=sMKE9+q0Dh0q2fgAnNSJaMiGGhkv/VNO3lY3K/oikNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FmdKjZWDZOLcphHVJ8fgpDra0f7RwqTvGX56ZsEkXtNjDFpUnG+m8rVCX7lXtLAv/TSwWjgRaljcqvsKV7UtXycE9QQ+R/t2DMGxh8IhKWSfmLYfuagFu8eNRyknFP4UuS2yrBK4YwXeWHbzPcEwCw+kmFboCwH4ZmVlSenTBrY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mf7Ha07Z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39F4FC433F1; Wed, 13 Mar 2024 16:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347613; bh=sMKE9+q0Dh0q2fgAnNSJaMiGGhkv/VNO3lY3K/oikNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mf7Ha07ZDQiepiTA6A3HhACGX1CuF6vw6YADJ078+v9JVoH9bukKdaXLCmZWof1zh dfYCnN9uIMJGbEzELIpGo22MFCJZeBt7nLrudGGOxMEQTMr/W1ThU5055/GHzplBxA kJI5yozhNIDWtB2Uc7Q2BAUkj1l/vrVqK2HgWMzGZ9jB/MGl+In1FVOxSJRi8rFZa2 O3xd9HGgTku0BN9drilz091GSZjoNFc5Fl7DSh8AL9U5tueUYxIRBy3sF5G1r8T77s qxxHt0mQbV+e7rUDZDsLH02qZPhsMgGnocHYaKfANkka5cn38K+rW7DusSX/SGZddD Wn/hi5/MyLaqQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jason Xing , Paolo Abeni , Sasha Levin Subject: [PATCH 6.7 45/61] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Date: Wed, 13 Mar 2024 12:32:20 -0400 Message-ID: <20240313163236.613880-46-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163236.613880-1-sashal@kernel.org> References: <20240313163236.613880-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.7.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.7.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.7.10-rc1 X-KernelTest-Deadline: 2024-03-15T16:32+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jason Xing [ Upstream commit 119cae5ea3f9e35cdada8e572cc067f072fa825a ] We need to protect the reader reading the sysctl value because the value can be changed concurrently. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jason Xing Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/netrom/nr_dev.c | 2 +- net/netrom/nr_out.c | 2 +- net/netrom/nr_subr.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 3aaac4a22b387..2c34389c3ce6f 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c @@ -81,7 +81,7 @@ static int nr_header(struct sk_buff *skb, struct net_device *dev, buff[6] |= AX25_SSSID_SPARE; buff += AX25_ADDR_LEN; - *buff++ = sysctl_netrom_network_ttl_initialiser; + *buff++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser); *buff++ = NR_PROTO_IP; *buff++ = NR_PROTO_IP; diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c index 44929657f5b71..5e531394a724b 100644 --- a/net/netrom/nr_out.c +++ b/net/netrom/nr_out.c @@ -204,7 +204,7 @@ void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb) dptr[6] |= AX25_SSSID_SPARE; dptr += AX25_ADDR_LEN; - *dptr++ = sysctl_netrom_network_ttl_initialiser; + *dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser); if (!nr_route_frame(skb, NULL)) { kfree_skb(skb); diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c index e2d2af924cff4..c3bbd5880850b 100644 --- a/net/netrom/nr_subr.c +++ b/net/netrom/nr_subr.c @@ -182,7 +182,8 @@ void nr_write_internal(struct sock *sk, int frametype) *dptr++ = nr->my_id; *dptr++ = frametype; *dptr++ = nr->window; - if (nr->bpqext) *dptr++ = sysctl_netrom_network_ttl_initialiser; + if (nr->bpqext) + *dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser); break; case NR_DISCREQ: @@ -236,7 +237,7 @@ void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags) dptr[6] |= AX25_SSSID_SPARE; dptr += AX25_ADDR_LEN; - *dptr++ = sysctl_netrom_network_ttl_initialiser; + *dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser); if (mine) { *dptr++ = 0; -- 2.43.0