From: AMEET M. PARANJAPE <aparanja@redhat.com> Date: Thu, 23 Oct 2008 17:01:13 -0400 Subject: [net] ixgbe: bring up device without crashing fix Message-id: 20081023210055.12753.69072.sendpatchset@squad5-lp1.lab.bos.redhat.com O-Subject: [PATCH RHEL5.3 BZ467777] Fix devices using ixgbe module crashing on bring-up Bugzilla: 467777 RH-Acked-by: Neil Horman <nhorman@redhat.com> RH-Acked-by: Andy Gospodarek <gospo@redhat.com> RH-Acked-by: David Howells <dhowells@redhat.com> RHBZ#: ====== https://bugzilla.redhat.com/show_bug.cgi?id=467777 Description: =========== The problem is a structure mismatch, that the root cause is in the following block of code: struct ixgbe_q_vector *q_vector = &adapter->q_vector[i]; q_vector->dummy_netdev = alloc_netdev(0, "", ether_setup); if (!q_vector->dummy_netdev) return -ENOMEM; q_vector->dummy_netdev->priv = q_vector; So, it assigns a ixgbe_q_vector to the priv field in a NAPI structure. So, when the code gets into ixgbe_poll(), it calls netdev_priv() which will return a ixgbe_q_vector in this case, but it's expecting a ixgbe_adpter, instead of a ixgbe_q_vector. Here is this line: struct ixgbe_adapter *adapter = netdev_priv(netdev); So, here after, adapter points to an structure different from what is expected. And, every filed it points is mismached (points to somewhere else). For example: netif_carrier_ok(adapter->netdev) Points to a place that doesn't has anything there, because of the structure are different. RHEL Version Found: ================ RHEL 5.3 alpha kABI Status: ============ No symbols were harmed. Brew: ===== Built on all platforms. http://brewweb.devel.redhat.com/brew/taskinfo?taskID=1537870 Upstream Status: ================ This problem is not see upstream. There may have been a mistake during the 1.3.18-k4 backport. Test Status: ============ The steps to recreate: -load ixgbe module - ifup the ixgbe adapater Without the patch the steps above crash the system and with the patch the system and device are up for I/O. =============================================================== Ameet Paranjape 978-392-3903 ext 23903 IBM on-site partner Proposed Patch: =============== diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index c61d4c3..02762fd 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -1924,7 +1924,8 @@ static void ixgbe_shutdown(struct pci_dev *pdev) **/ static int ixgbe_poll(struct net_device *netdev, int *budget) { - struct ixgbe_adapter *adapter = netdev_priv(netdev); + struct ixgbe_q_vector *q_vector = netdev->priv; + struct ixgbe_adapter *adapter = q_vector->adapter; int work_to_do = min(*budget, netdev->quota); int tx_cleaned = 0, work_done = 0;