summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2011-02-15 19:39:21 +0000
committerBen Hutchings <bhutchings@solarflare.com>2011-02-15 19:45:33 +0000
commit5c56580b74e57e56f30e3c5bbc9d7ab487858497 (patch)
tree004f217312262babf57bec4c0c816d71cedc875e
parentac7100ba93428a26cde8e47dfcfcfbfbfcce66de (diff)
downloadlinux-5c56580b74e57e56f30e3c5bbc9d7ab487858497.tar.gz
net: Adjust TX queue kobjects if number of queues changes during unregister
If the root qdisc for a net device is mqprio, and the driver's
ndo_setup_tc() operation dynamically adds and remvoes TX queues,
netif_set_real_num_tx_queues() will be called during device
unregistration to remove the extra TX queues when the qdisc is
destroyed.  Currently this causes the corresponding kobjects
to be leaked, and the device's reference count never drops to 0.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r--net/core/dev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 6392ea0a5910..30c71f9b0419 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1648,7 +1648,8 @@ int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq)
 	if (txq < 1 || txq > dev->num_tx_queues)
 		return -EINVAL;
 
-	if (dev->reg_state == NETREG_REGISTERED) {
+	if (dev->reg_state == NETREG_REGISTERED ||
+	    dev->reg_state == NETREG_UNREGISTERING) {
 		ASSERT_RTNL();
 
 		rc = netdev_queue_update_kobjects(dev, dev->real_num_tx_queues,