]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[virtio] Fix assertion failures when interface is closed
authorMichael Brown <mcb30@ipxe.org>
Thu, 23 Apr 2026 13:57:20 +0000 (14:57 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 23 Apr 2026 13:57:20 +0000 (14:57 +0100)
The unused RX I/O buffers are currently freed without being deleted
from the list, with the list head being reinitialised only after all
buffers have been deleted.  This triggers assertion failures due to
the list integrity checks when debugging is enabled.

Fix by deleting each buffer individually, so that the list structure
remains valid at all times.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/virtio-net.c

index cb55ea0419e550223cdc8e12c6098d9df0a828c6..e4700279887085888db305aaa1e3da8ec45a5682 100644 (file)
@@ -338,10 +338,11 @@ static void virtnet_close ( struct net_device *netdev ) {
        virtnet_free_virtqueues ( netdev );
 
        /* Free rx iobufs */
-       list_for_each_entry_safe ( iobuf, next_iobuf, &virtnet->rx_iobufs, list ) {
+       list_for_each_entry_safe ( iobuf, next_iobuf, &virtnet->rx_iobufs,
+                                  list ) {
+               list_del ( &iobuf->list );
                free_rx_iob ( iobuf );
        }
-       INIT_LIST_HEAD ( &virtnet->rx_iobufs );
        virtnet->rx_num_iobufs = 0;
 }