Skip to contentSkip to conversation

ixgbe: fix panic when using macvlan with l2-fwd-offload enabled

PATCH New Emil Tantilov 2 participants 2 messages Sep 22, 2016 – Sep 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbe: fix panic when using macvlan with l2-fwd-offload enabled

Fix NULL pointer dereference in the case where a macvlan interface is brought up while the PF is still down:

#ip link set eth2 down
#ip link add link eth2 type macvlan
#ip link set macvlan0 up

BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
IP: [<ffffffffa0170fb2>] ixgbe_alloc_rx_buffers+0x42/0x1a0 [ixgbe]

Call Trace:
[<ffffffffa017336b>] ixgbe_configure_rx_ring+0x2eb/0x3d0 [ixgbe]
[<ffffffffa0173811>] ixgbe_fwd_ring_up+0xd1/0x380 [ixgbe]
[<ffffffffa0179709>] ixgbe_fwd_add+0x149/0x230 [ixgbe]
[<ffffffffa0113480>] macvlan_open+0x260/0x2b0 [macvlan]
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 -4
index a244d9a..bd93d82 100644
@@ -9135,10 +9135,14 @@ static void *ixgbe_fwd_add(struct net_device *pdev, struct net_device *vdev)
 		goto fwd_add_err;
 	fwd_adapter->pool = pool;
 	fwd_adapter->real_adapter = adapter;
-	err = ixgbe_fwd_ring_up(vdev, fwd_adapter);
-	if (err)
-		goto fwd_add_err;
-	netif_tx_start_all_queues(vdev);
+
+	if (netif_running(pdev)) {
+		err = ixgbe_fwd_ring_up(vdev, fwd_adapter);
+		if (err)
+			goto fwd_add_err;
+		netif_tx_start_all_queues(vdev);
+	}
+
 	return fwd_adapter;
 fwd_add_err:
 	/* unwind counter and free adapter struct */
#1 lore raw

PATCH 1/1 ixgbe: fix panic when using macvlan with l2-fwd-offload enabled

Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Emil Tantilov
Sent: Thursday, September 22, 2016 3:07 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [net-next PATCH] ixgbe: fix panic when using macvlan with l2-fwd-offload enabled

Fix NULL pointer dereference in the case where a macvlan interface is brought up while the PF is still down:

#ip link set eth2 down
#ip link add link eth2 type macvlan
#ip link set macvlan0 up

BUG: unable to handle kernel NULL pointer dereference at

0000000000000010
IP: [<ffffffffa0170fb2>] ixgbe_alloc_rx_buffers+0x42/0x1a0 [ixgbe]

Call Trace:
[<ffffffffa017336b>] ixgbe_configure_rx_ring+0x2eb/0x3d0 [ixgbe]
[<ffffffffa0173811>] ixgbe_fwd_ring_up+0xd1/0x380 [ixgbe]
[<ffffffffa0179709>] ixgbe_fwd_add+0x149/0x230 [ixgbe]
[<ffffffffa0113480>] macvlan_open+0x260/0x2b0 [macvlan]
Quoted 5 lines
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)