summary refs log tree commit diff
path: root/drivers/net/xen-netfront.c
diff options
context:
space:
mode:
authorChas Williams <3chas3@gmail.com>2015-08-19 19:14:20 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-23 15:56:12 -0700
commit9a873c71e91cabf4c10fd9bbd8358c22deaf6c9e (patch)
tree67675aa39ba853e69550a74fe96968510cb46d2e /drivers/net/xen-netfront.c
parentf5117ce4f6a16fa2a02ceff9c337cfffca8b75f2 (diff)
downloadlinux-9a873c71e91cabf4c10fd9bbd8358c22deaf6c9e.tar.gz
net/xen-netfront: only clean up queues if present
If you simply load and unload the module without starting the interfaces,
the queues are never created and you get a bad pointer dereference.

Signed-off-by: Chas Williams <3chas3@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netfront.c')
-rw-r--r--drivers/net/xen-netfront.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index f948c46d5132..002062db2f1d 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -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;