Patchwork netxen: check for root bus in netxen_mask_aer_correctable

login
register
mail settings
Submitter Nikolay Aleksandrov
Date Sept. 14, 2012, 3:50 p.m.
Message ID <1347637803-4837-1-git-send-email-nikolay@redhat.com>
Download mbox | patch
Permalink /patch/183963/
State Accepted
Delegated to: David Miller
Headers show

Comments

Nikolay Aleksandrov - Sept. 14, 2012, 3:50 p.m.
From: Nikolay Aleksandrov <nikolay@redhat.com>

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>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++++
 1 file changed, 4 insertions(+)
David Miller - Sept. 18, 2012, 8:23 p.m.
From: nikolay@redhat.com
Date: Fri, 14 Sep 2012 17:50:03 +0200

> From: Nikolay Aleksandrov <nikolay@redhat.com>
> 
> 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>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 342b3a7..e2a4858 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1378,6 +1378,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;