Skip to content

Commit fe9a8f5

Browse files
jgross1gregkh
authored andcommitted
xen/netfront: fix crash when removing device
commit f9244fb upstream. When removing a netfront device directly after a suspend/resume cycle it might happen that the queues have not been setup again, causing a crash during the attempt to stop the queues another time. Fix that by checking the queues are existing before trying to stop them. This is XSA-465 / CVE-2024-53240. Reported-by: Marek Marczykowski-Górecki <[email protected]> Fixes: d50b791 ("xen-netfront: Fix NULL sring after live migration") Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4a41bb9 commit fe9a8f5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/xen-netfront.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev
867867
static int xennet_close(struct net_device *dev)
868868
{
869869
struct netfront_info *np = netdev_priv(dev);
870-
unsigned int num_queues = dev->real_num_tx_queues;
870+
unsigned int num_queues = np->queues ? dev->real_num_tx_queues : 0;
871871
unsigned int i;
872872
struct netfront_queue *queue;
873873
netif_tx_stop_all_queues(np->netdev);
@@ -882,6 +882,9 @@ static void xennet_destroy_queues(struct netfront_info *info)
882882
{
883883
unsigned int i;
884884

885+
if (!info->queues)
886+
return;
887+
885888
for (i = 0; i < info->netdev->real_num_tx_queues; i++) {
886889
struct netfront_queue *queue = &info->queues[i];
887890

0 commit comments

Comments
 (0)