Skip to content

Commit 1c54e7e

Browse files
committed
[virtio] Fix assertion failures when interface is closed
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>
1 parent 2b2580f commit 1c54e7e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/drivers/net/virtio-net.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,11 @@ static void virtnet_close ( struct net_device *netdev ) {
338338
virtnet_free_virtqueues ( netdev );
339339

340340
/* Free rx iobufs */
341-
list_for_each_entry_safe ( iobuf, next_iobuf, &virtnet->rx_iobufs, list ) {
341+
list_for_each_entry_safe ( iobuf, next_iobuf, &virtnet->rx_iobufs,
342+
list ) {
343+
list_del ( &iobuf->list );
342344
free_rx_iob ( iobuf );
343345
}
344-
INIT_LIST_HEAD ( &virtnet->rx_iobufs );
345346
virtnet->rx_num_iobufs = 0;
346347
}
347348

0 commit comments

Comments
 (0)