From nobody Sun Sep 7 12:18:21 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17351C54EE9 for ; Fri, 2 Sep 2022 12:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236909AbiIBMfK (ORCPT ); Fri, 2 Sep 2022 08:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236936AbiIBMdq (ORCPT ); Fri, 2 Sep 2022 08:33:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE8A3E3438; Fri, 2 Sep 2022 05:28:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 158CFB82AA1; Fri, 2 Sep 2022 12:28:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DDB7C433C1; Fri, 2 Sep 2022 12:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121683; bh=bjlUEf+Dr1gI09ygxVRd1FmBAP970UMclWHUNlzSSjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rE2jXoE3vAgqf4mqK9lGxlFKjuee/htTOmDdygFkhVCH0sGNRXpfDU9i/t3aTN9Xk BlaejM7Th1ssUN7/aboVh1W0OeT2Yg39G4LydONHzqC0NxLs0ZHcgWaz178q8rox4J rWkYLSet+cp+XypbUEHF16lwa1Nz2w1GYAGbU220= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 32/77] net: Fix a data-race around netdev_budget. Date: Fri, 2 Sep 2022 14:18:41 +0200 Message-Id: <20220902121404.710820787@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121403.569927325@linuxfoundation.org> References: <20220902121403.569927325@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kuniyuki Iwashima [ Upstream commit 2e0c42374ee32e72948559d2ae2f7ba3dc6b977c ] While reading netdev_budget, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 51b0bdedb8e7 ("[NET]: Separate two usages of netdev_max_backlog.") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 99b0025864984..7c19e672dde84 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6394,7 +6394,7 @@ static __latent_entropy void net_rx_action(struct sof= tirq_action *h) struct softnet_data *sd =3D this_cpu_ptr(&softnet_data); unsigned long time_limit =3D jiffies + usecs_to_jiffies(netdev_budget_usecs); - int budget =3D netdev_budget; + int budget =3D READ_ONCE(netdev_budget); LIST_HEAD(list); LIST_HEAD(repoll); =20 --=20 2.35.1