netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: set default_ethtool_ops in register_netdevice
@ 2013-01-08 15:38 Stanislaw Gruszka
  2013-01-10  7:57 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Stanislaw Gruszka @ 2013-01-08 15:38 UTC (permalink / raw)
  To: netdev, David S. Miller
  Cc: Eric Dumazet, Ben Greear, Bjørn Mork, linux-wireless,
	Ben Hutchings, Michał Mirosław

Since:

commit 2c60db037034d27f8c636403355d52872da92f81
Author: Eric Dumazet <edumazet@google.com>
Date:   Sun Sep 16 09:17:26 2012 +0000

    net: provide a default dev->ethtool_ops

wireless core does not correctly assign ethtool_ops. In order to fix
the problem, move assignement of default_ethtool_ops to
register_netdevice(). This is safe because both register_netdevice()
and dev_ethtool() are protected by RTNL lock.

Patch is besed on hint of Michał Mirosław.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: stable@vger.kernel.org # 3.7+
---
v1 -> v2: change order of default_ethtool_ops initialization to avoid
the problem. Change the subject accordingly.

 net/core/dev.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/net/core/dev.c b/net/core/dev.c
index 515473e..3196820 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5710,6 +5710,8 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
 	return 0;
 }
 
+static const struct ethtool_ops default_ethtool_ops;
+
 /**
  *	register_netdevice	- register a network device
  *	@dev: device to register
@@ -5830,6 +5832,8 @@ int register_netdevice(struct net_device *dev)
 	    dev->rtnl_link_state == RTNL_LINK_INITIALIZED)
 		rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
 
+	if (!dev->ethtool_ops)
+		dev->ethtool_ops = &default_ethtool_ops;
 out:
 	return ret;
 
@@ -6119,8 +6123,6 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
 	return queue;
 }
 
-static const struct ethtool_ops default_ethtool_ops;
-
 /**
  *	alloc_netdev_mqs - allocate network device
  *	@sizeof_priv:	size of private data to allocate space for
@@ -6208,8 +6210,6 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 
 	strcpy(dev->name, name);
 	dev->group = INIT_NETDEV_GROUP;
-	if (!dev->ethtool_ops)
-		dev->ethtool_ops = &default_ethtool_ops;
 	return dev;
 
 free_all:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-10 21:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 15:38 [PATCH v2] net: set default_ethtool_ops in register_netdevice Stanislaw Gruszka
2013-01-10  7:57 ` David Miller
2013-01-10  8:36   ` Stanislaw Gruszka
2013-01-10 10:07     ` David Miller
     [not found]       ` <20130110.020729.1358020934840866117.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2013-01-10 10:12         ` David Miller
     [not found]           ` <20130110.021202.232771737304117743.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2013-01-10 11:41             ` Johannes Berg
2013-01-10 21:00               ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).