Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3386071pxb; Mon, 17 Jan 2022 19:17:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPFOoFcGfb+9u+xu1tlY/aAU/cJTXNRju1QLZS8Z1gGEgfARceHOL+d+/ud/sqpsSbdYyN X-Received: by 2002:a05:6a00:2444:b0:4ab:15b9:20e5 with SMTP id d4-20020a056a00244400b004ab15b920e5mr23914571pfj.0.1642475840284; Mon, 17 Jan 2022 19:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475840; cv=none; d=google.com; s=arc-20160816; b=sd6uXLXpvHwRJWKFIW7sLmDnYYiIexI7Fin434Wl9Fer12lzD4I4g3JFIn3ScfcP6t omecGMtbgd2t4VE3DIDCbB59itG2kPRoqO0hEa9ORItn29zQ2prhi1Xv/+bGmGcMnCLH pg/YmQBC4Easj2Hb8apqkpgQu+NUO6qnpV1wGHJWs0iEgEBE657UB7enQ/Naa5WtAlRx UNXHH/p9mbQumExnotaGq7x4x5e6dH1bv3uTvaDmRpytq+zLCEM4biRItxA1NwPtWeO5 R/8a40nkvHtyP3YDKYRhjrZY1MF2gODhc8+m2E+949a0dNjXao7h1kfV/MkVkS845pYN w3bw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nxuAEaDrzFMgenXmk/qgThBSB6K8cl+EyERfhUJXjJw=; b=JxRE/qhsrOjM75gwj6w4MR9Q552AxZIPLI5XgBYVbk4p2+GxvPp2s3R1U4FQ6Stf4Z HKfXIg8EOhkhqpaYrkrSLHHYC9ulblmXiirKR7JbmPrtcgLbcwsb00wVGiHtNdC6PQNR HU614awXFCLRtZzu/rcnyL/D9xbV+KVgTIipGc0z7Pz48xXBlBeB5Yu4QAedMrDKHlmG xwePjq42A2JGoTo03n5QdQfzg9QT1faEjHIt8qA4NAbSWPApQaQ9s74CEkgqwk9c2J7l jlc2XgInMS487PvU+cIf6kELjWJPyK/ie/CzCkGxdIh/ODknCiA2RYSCfevcmT5LatZc EkHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UVyZ+ITf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si10280192pfu.350.2022.01.17.19.17.05; Mon, 17 Jan 2022 19:17:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UVyZ+ITf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343850AbiARC12 (ORCPT + 99 others); Mon, 17 Jan 2022 21:27:28 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42242 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245724AbiARCZW (ORCPT ); Mon, 17 Jan 2022 21:25:22 -0500 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 C1CBB610AB; Tue, 18 Jan 2022 02:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38C66C36AEB; Tue, 18 Jan 2022 02:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472721; bh=KnyhTXWyAhQ6+TJyfkCxRN8k4+AZ9shB9T5IiZSCg30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UVyZ+ITfaM1Bxng40gQmHAhb7ALZxTKy4X+TJQWC0RkL1LxPuIXSH2BqtVlqe2FAY rVQ9qQPRnb2QGQ3Mbv4e2Z66cweSO28mOVrNIR2QJcO3TP6Tw9n/VdDmvdvHjXwy3f uhrbVPflmgtam0WzAke5Sty4PZT4ano+WEXWA500YxI5Ha9srJ3dLjf+r0lvrtB7Te LON34ffoNDUfwF5pd6F8JPWTpxQkqK+bUYFDm1N8+THEx6D94pcpInTQfqdObwKvYa 28p6o0koVaZS+XsDRCHlulZzuetwjRO/bVb0G7pEJdCIK+3MTEpstpEV/bVW9dRneO MbKBt0+hF9FAg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Antoine Tenart , Jakub Kicinski , Sasha Levin , davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, weiwan@google.com, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 112/217] net-sysfs: update the queue counts in the unregistration path Date: Mon, 17 Jan 2022 21:17:55 -0500 Message-Id: <20220118021940.1942199-112-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antoine Tenart [ Upstream commit d7dac083414eb5bb99a6d2ed53dc2c1b405224e5 ] When updating Rx and Tx queue kobjects, the queue count should always be updated to match the queue kobjects count. This was not done in the net device unregistration path, fix it. Tracking all queue count updates will allow in a following up patch to detect illegal updates. Signed-off-by: Antoine Tenart Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/net-sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 9c01c642cf9ef..d7f9ee830d34c 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1820,6 +1820,9 @@ static void remove_queue_kobjects(struct net_device *dev) net_rx_queue_update_kobjects(dev, real_rx, 0); netdev_queue_update_kobjects(dev, real_tx, 0); + + dev->real_num_rx_queues = 0; + dev->real_num_tx_queues = 0; #ifdef CONFIG_SYSFS kset_unregister(dev->queues_kset); #endif -- 2.34.1