Skip to contentSkip to conversation

net/xen-netfront: only clean up queues if present

PATCH Applied Charles (Chas) Williams 2 participants 2 messages Aug 19, 2015 – Aug 23, 2015

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

PATCH 1/1 net/xen-netfront: only clean up queues if present

From: Chas Williams <[email protected]>

If you simply load and unload the module without starting the interfaces, the queues are never created and you get a bad pointer dereference.

---
 drivers/net/xen-netfront.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/xen-netfront.c +3 -2
index f948c46..002062d 100644
@@ -1336,7 +1336,7 @@ static void xennet_disconnect_backend(struct netfront_info *info)
 
 	netif_carrier_off(info->netdev);
 
-	for (i = 0; i < num_queues; ++i) {
+	for (i = 0; i < num_queues && info->queues; ++i) {
 		struct netfront_queue *queue = &info->queues[i];
 
 		if (queue->tx_irq && (queue->tx_irq == queue->rx_irq))
@@ -2101,7 +2101,8 @@ static int xennet_remove(struct xenbus_device *dev)
 
 	unregister_netdev(info->netdev);
 
-	xennet_destroy_queues(info);
+	if (info->queues)
+		xennet_destroy_queues(info);
 	xennet_free_netdev(info->netdev);
 
 	return 0;
Signature · 1 line
2.1.0