All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antoine Tenart <atenart@kernel.org>
To: davem@davemloft.net, kuba@kernel.org
Cc: Antoine Tenart <atenart@kernel.org>,
	alexander.duyck@gmail.com, netdev@vger.kernel.org
Subject: [PATCH net-next 1/2] net-sysfs: update the queue counts in the unregistration path
Date: Tue,  7 Dec 2021 15:57:24 +0100	[thread overview]
Message-ID: <20211207145725.352657-2-atenart@kernel.org> (raw)
In-Reply-To: <20211207145725.352657-1-atenart@kernel.org>

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 <atenart@kernel.org>
---
 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 3b2cdbbdc858..33f408c24205 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1808,6 +1808,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.33.1


  reply	other threads:[~2021-12-07 14:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 14:57 [PATCH net-next 0/2] net: track the queue count at unregistration Antoine Tenart
2021-12-07 14:57 ` Antoine Tenart [this message]
2021-12-07 14:57 ` [PATCH net-next 2/2] net-sysfs: warn if new queue objects are being created during device unregistration Antoine Tenart
2021-12-09  2:50 ` [PATCH net-next 0/2] net: track the queue count at unregistration patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211207145725.352657-2-atenart@kernel.org \
    --to=atenart@kernel.org \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.