virtio_net: fix use after free on allocation failure
In the extremely unlikely event that driver initialization fails after RX buffers are added, virtio net frees RX buffers while VQs are still active, potentially causing device to use a freed buffer. To fix, reset device first - same as we do on device removal. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Родитель
64b4cc3911
Коммит
0246555550
|
@ -1830,6 +1830,8 @@ static int virtnet_probe(struct virtio_device *vdev)
|
|||
return 0;
|
||||
|
||||
free_recv_bufs:
|
||||
vi->vdev->config->reset(vdev);
|
||||
|
||||
free_receive_bufs(vi);
|
||||
unregister_netdev(dev);
|
||||
free_vqs:
|
||||
|
|
Загрузка…
Ссылка в новой задаче