On Wed, Sep 21, 2016 at 06:57:20PM +0200, Greg Kurz wrote:
> @@ -586,13 +589,16 @@ void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq)
>      blk_io_plug(s->blk);
>  
>      while ((req = virtio_blk_get_request(s, vq))) {
> -        virtio_blk_handle_request(req, &mrb);
> +        if (virtio_blk_handle_request(req, &mrb)) {
> +            goto out_err;
> +        }
>      }
>  
>      if (mrb.num_reqs) {
>          virtio_blk_submit_multireq(s->blk, &mrb);
>      }
>  
> +out_err:
>      blk_io_unplug(s->blk);

req is leaked.  We must detach it from the virtqueue and free it.

>  }
>  
> @@ -625,7 +631,9 @@ static void virtio_blk_dma_restart_bh(void *opaque)
>  
>      while (req) {
>          VirtIOBlockReq *next = req->next;
> -        virtio_blk_handle_request(req, &mrb);
> +        if (virtio_blk_handle_request(req, &mrb)) {
> +            return;

s->rq is leaked.  We must detach and free the remaining requests.  See
virtio_blk_reset().

Attachment: signature.asc
Description: PGP signature

Reply via email to