Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3712444pxb; Mon, 24 Jan 2022 16:05:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS1suQEm+O66lrP+E+9m5N9emd454nrmdjBLMsxIJbYHxDGqdCxC2tnmBDD8c5CYBAjiJM X-Received: by 2002:a63:af48:: with SMTP id s8mr13390237pgo.615.1643069105274; Mon, 24 Jan 2022 16:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069105; cv=none; d=google.com; s=arc-20160816; b=i0xYu1L7Y13gd0GUlXSYtEADK637jsIVHuZFe7zNMzTEF959K5YjMMc/1UM07fh1ZG IcDWnkNQD1dkkyS2jXVmMc5/NMhqKLCF0q5HnJ0OeFs2mAl5zIxV7PpBkYsK+TZTM2Oc 8yuY+S6uSF01T/0orA0hNJE14u7KcHhSd9McALNd4nsAd/gwikXUJJnpO7XlgJMUGoJP zr/0YzGMA7aNlIN/QJx3vowE4BkLoM/UDRLTQHB4QwMYN6yJ4T2ZhkRvhUC2i+1P0Rce BsGpFqNTJPC/q4gDE/QfgGHGhgZ6hOVXIpULdHo3U3nfcqtvfkRgkGKY7jtkHqztMxh8 WgRA== 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=nxuAEaDrzFMgenXmk/qgThBSB6K8cl+EyERfhUJXjJw=; b=dsKWr8DabPZxqaF/dnaMtTwlGUuXyPnf5B6vxbnawEy/Vr0Kg4VNVJk1tkYdrKQU3b jnWj4fQs+JEQ22KBBCbLtS6II4+yvvC8WWNvjKnRxW/0Z2MFMErX81mV0IUw0hEhlPNf OkuDlO5MSOiUcF2HsITcRZyX7NvYgliAvfPZAWmuJ/UbpMb3TXctX0i5dbE/Np2Y6reX 4sOwDuXhGXWYnjNiMHrAWMmKLMk5bh2Ps0W9ntPEZh1Ep6DUpfQwpHqIhDgPb8EJarit Ue87egLdCKjmGTwwiDw/3JkCk/hXAswwguSpR0By2hz9exX7HVKju8cUAU1Vy780gfvZ /tXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SLLIhh1J; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bk5si635716pjb.23.2022.01.24.16.04.52; Mon, 24 Jan 2022 16:05:05 -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=@linuxfoundation.org header.s=korg header.b=SLLIhh1J; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386281AbiAXX5J (ORCPT + 99 others); Mon, 24 Jan 2022 18:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846418AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B05C0604D8; Mon, 24 Jan 2022 13:24:45 -0800 (PST) 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 4757AB8122A; Mon, 24 Jan 2022 21:24:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75869C340E4; Mon, 24 Jan 2022 21:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059483; bh=KnyhTXWyAhQ6+TJyfkCxRN8k4+AZ9shB9T5IiZSCg30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLLIhh1JEZYVZQcPCcIHDWexNiPeIwyfJ7VvU83HWGlBj/OAKR6eKpwiFVKhcVNgb UsxVJtSsWcPIAqFwIoGHJ9TLNZHhGLkmDviIMkoZhrhjQhslgzx6tw/Xv8DjcFk3hP 3EmX944dv5RE0yFEHsS4zHDigI0WIqW5DmgRBm7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antoine Tenart , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0631/1039] net-sysfs: update the queue counts in the unregistration path Date: Mon, 24 Jan 2022 19:40:20 +0100 Message-Id: <20220124184146.560054936@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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