]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
netxen: check for root bus in netxen_mask_aer_correctable
authorNikolay Aleksandrov <nikolay@redhat.com>
Fri, 14 Sep 2012 05:50:03 +0000 (05:50 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 10 Oct 2012 02:31:26 +0000 (03:31 +0100)
[ Upstream commit e4d1aa40e363ed3e0486aeeeb0d173f7f822737e ]

Add a check if pdev->bus->self == NULL (root bus). When attaching
a netxen NIC to a VM it can be on the root bus and the guest would
crash in netxen_mask_aer_correctable() because of a NULL pointer
dereference if CONFIG_PCIEAER is present.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c

index 8cf3173ba48818edb795536d5accf7b7ff447de4..da5204dc51f3c5dc46c99ace589c251e7f562851 100644 (file)
@@ -1351,6 +1351,10 @@ static void netxen_mask_aer_correctable(struct netxen_adapter *adapter)
        struct pci_dev *root = pdev->bus->self;
        u32 aer_pos;
 
+       /* root bus? */
+       if (!root)
+               return;
+
        if (adapter->ahw.board_type != NETXEN_BRDTYPE_P3_4_GB_MM &&
                adapter->ahw.board_type != NETXEN_BRDTYPE_P3_10G_TP)
                return;