netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@redhat.com>,
	Scott Feldman <scott.feldman@intel.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH 2.5.70] e100 initialize fields prior to register_netdevice
Date: Thu, 29 May 2003 10:36:50 -0700	[thread overview]
Message-ID: <20030529103650.64d61340.shemminger@osdl.org> (raw)

The e100 driver sets many of the fields in the netdevice structure after
calling the register function.  This confuses the sysfs setup, because
it uses the presence of the get_stats function pointer to decide whether
to setup a statistics directory or not.  The earlier patch to net-sysfs
keeps this from causing a crash.

This patch moves the initialization earlier before registration.  It probably
closes other races as well, where some program could access the e100 driver
before the pointers were setup.

--- linux-2.5/drivers/net/e100/e100_main.c	2003-05-27 11:04:34.000000000 -0700
+++ linux-2.5-sysfs/drivers/net/e100/e100_main.c	2003-05-29 08:56:47.000000000 -0700
@@ -614,6 +614,22 @@
 		goto err_dealloc;
 	}
 
+	dev->vlan_rx_register = e100_vlan_rx_register;
+	dev->vlan_rx_add_vid = e100_vlan_rx_add_vid;
+	dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid;
+	dev->irq = pcid->irq;
+	dev->open = &e100_open;
+	dev->hard_start_xmit = &e100_xmit_frame;
+	dev->stop = &e100_close;
+	dev->change_mtu = &e100_change_mtu;
+	dev->get_stats = &e100_get_stats;
+	dev->set_multicast_list = &e100_set_multi;
+	dev->set_mac_address = &e100_set_mac;
+	dev->do_ioctl = &e100_ioctl;
+	if (bdp->flags & USE_IPCB)
+		dev->features = NETIF_F_SG | NETIF_F_HW_CSUM |
+				NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+
 	if ((rc = register_netdev(dev)) != 0) {
 		goto err_pci;
 	}
@@ -660,23 +676,6 @@
                 goto err_unregister_netdev;
 	}
 	
-	dev->vlan_rx_register = e100_vlan_rx_register;
-	dev->vlan_rx_add_vid = e100_vlan_rx_add_vid;
-	dev->vlan_rx_kill_vid = e100_vlan_rx_kill_vid;
-	dev->irq = pcid->irq;
-	dev->open = &e100_open;
-	dev->hard_start_xmit = &e100_xmit_frame;
-	dev->stop = &e100_close;
-	dev->change_mtu = &e100_change_mtu;
-	dev->get_stats = &e100_get_stats;
-	dev->set_multicast_list = &e100_set_multi;
-	dev->set_mac_address = &e100_set_mac;
-	dev->do_ioctl = &e100_ioctl;
-
-	if (bdp->flags & USE_IPCB)
-	dev->features = NETIF_F_SG | NETIF_F_HW_CSUM |
-			NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-		
 	e100nics++;
 
 	e100_get_speed_duplex_caps(bdp);

             reply	other threads:[~2003-05-29 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-29 17:36 Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-29 22:45 [PATCH 2.5.70] e100 initialize fields prior to register_netdevice Feldman, Scott
     [not found] <C6F5CF431189FA4CBAEC9E7DD5441E0101BE5F5E@orsmsx402.jf.intel.com>
2003-05-29 23:48 ` Feldman, Scott
2003-05-30  0:09   ` Jeff Garzik

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=20030529103650.64d61340.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    --cc=scott.feldman@intel.com \
    /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 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).