mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
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 <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
This commit is contained in:
parent
64b4cc3911
commit
0246555550
1 changed files with 2 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue