Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3053978rwe; Mon, 29 Aug 2022 05:12:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR6q7I4KGoM4tYVkUktt6Pw+DXSFNkDTlO6YaJGta64Puq+vHS71YI1VXDpt22LboDs5wVla X-Received: by 2002:a05:6402:2714:b0:448:945f:99cd with SMTP id y20-20020a056402271400b00448945f99cdmr1739283edd.31.1661775152575; Mon, 29 Aug 2022 05:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775152; cv=none; d=google.com; s=arc-20160816; b=nviJKaPVxWseqBJ5f3IJdqVf+WCYpBsKDDpdKBVAKwlFkC5QJgydwR2gwobL0JcvOK UCefEp72K4qULBhFbiqV1AipzKfd4mAkC7TCIz6Z3di4t8J4oWOiaRaxMe70msKCcEDP ceYgUYCxFT9iLecZ8qNssK3xZrfQoil+kC6LRGyH+bTP6cH+znCQHEW8eqKnJnaVhWfq Vl4mAjwerlMXCwfJ4lJyjMKh1T0veli4qrRRj9qKEGvJTgBVL03e28sPeS3ShaDhy7Zx mNGOUh0djkMYyn+XOPywqmzvIameUh+VZ+jlc/m2wXSfTLmwYsWhGuMpMli0lHwIPD/v +1Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VnFyTaMxK97LPP0aNvYHuJkHJuIIQJje7DbJwJYS5Vc=; b=GQV/y54W4Syo7ORKQyVZxaZGZmOiwO0A7qMf5yy1cQDzaTiLZdhozbpmVPf0dKMMv8 SUPlksSnKTR+640j8oce4wfaiPcFv4mSHCp4v6Ene2fT/XB9ZNwozXGfT99IIhsVHxCP GGXNmF0Pyctq7xy4g0MsSTabT2Uy8y5LIac02J2FAV2glHaUesu1nnoXCb1rb7Pag1IW /0akKGhsDEocNb7/UZyg/nVHy2q4mrTRnrHnahjCqMCj4dMDAOeKO1Z4SVVVRPE3tf/6 Rdzo0AseUwHDqVKOQyzThmvQxn0mgkFxsL9eubQx4zsPnm+PEVUMs19u9kIBCpvk6kvL lUYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0mmCE+dk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v4-20020a509544000000b0043c78d2d9bdsi6879597eda.316.2022.08.29.05.12.01; Mon, 29 Aug 2022 05:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0mmCE+dk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbiH2Lb6 (ORCPT + 99 others); Mon, 29 Aug 2022 07:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232646AbiH2L3c (ORCPT ); Mon, 29 Aug 2022 07:29:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 419BC11A0A; Mon, 29 Aug 2022 04:17:54 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 4050B611D7; Mon, 29 Aug 2022 11:16:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C84DC433C1; Mon, 29 Aug 2022 11:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771817; bh=wp8U55d9Kn/DhgG7ZOW5xFAZkn6AbrlvNfjNqkzEp4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0mmCE+dk0TFIhYq+TIXPOd9+WIz4qflrFNqOGSszNuJhLX29oVb9dfyJGpZg7sgv1 aOiI8qBLE1EYN49qrLuqp5qZkQ44y+6DRBp0vtSfKgEpretrkC0a0StHmYsjPiWKXS MwkAPsbaym0DEUXVRY9FThZrMQlqIkopvOSx8IFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , Dmitry Vyukov , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 080/158] net: Fix a data-race around netdev_unregister_timeout_secs. Date: Mon, 29 Aug 2022 12:58:50 +0200 Message-Id: <20220829105812.403037195@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuniyuki Iwashima [ Upstream commit 05e49cfc89e4f325eebbc62d24dd122e55f94c23 ] While reading netdev_unregister_timeout_secs, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 5aa3afe107d9 ("net: make unregister netdev warning timeout configurable") Signed-off-by: Kuniyuki Iwashima Acked-by: Dmitry Vyukov 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 19baeaf65a646..a77a979a4bf75 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10265,7 +10265,7 @@ static struct net_device *netdev_wait_allrefs_any(struct list_head *list) return dev; if (time_after(jiffies, warning_time + - netdev_unregister_timeout_secs * HZ)) { + READ_ONCE(netdev_unregister_timeout_secs) * HZ)) { list_for_each_entry(dev, list, todo_list) { pr_emerg("unregister_netdevice: waiting for %s to become free. Usage count = %d\n", dev->name, netdev_refcnt_read(dev)); -- 2.35.1