linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe()
@ 2020-06-15  4:14 Hou Tao
  2020-06-15  7:32 ` Stefano Garzarella
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hou Tao @ 2020-06-15  4:14 UTC (permalink / raw)
  To: linux-block, virtualization
  Cc: Stefan Hajnoczi, Paolo Bonzini, Jens Axboe, Ming Lei

Else there will be memory leak if alloc_disk() fails.

Fixes: 6a27b656fc02 ("block: virtio-blk: support multi virt queues per virtio-blk device")
Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 drivers/block/virtio_blk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 9d21bf0f155e..980df853ee49 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -878,6 +878,7 @@ static int virtblk_probe(struct virtio_device *vdev)
 	put_disk(vblk->disk);
 out_free_vq:
 	vdev->config->del_vqs(vdev);
+	kfree(vblk->vqs);
 out_free_vblk:
 	kfree(vblk);
 out_free_index:
-- 
2.25.0.4.g0ad7144999


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe()
  2020-06-15  4:14 [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe() Hou Tao
@ 2020-06-15  7:32 ` Stefano Garzarella
  2020-06-29  4:28   ` Hou Tao
  2020-06-30 22:30 ` Ming Lei
  2020-07-01  1:03 ` Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Stefano Garzarella @ 2020-06-15  7:32 UTC (permalink / raw)
  To: Hou Tao
  Cc: linux-block, virtualization, Stefan Hajnoczi, Paolo Bonzini,
	Jens Axboe, Ming Lei

On Mon, Jun 15, 2020 at 12:14:59PM +0800, Hou Tao wrote:
> Else there will be memory leak if alloc_disk() fails.
> 
> Fixes: 6a27b656fc02 ("block: virtio-blk: support multi virt queues per virtio-blk device")
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
>  drivers/block/virtio_blk.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 9d21bf0f155e..980df853ee49 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -878,6 +878,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>  	put_disk(vblk->disk);
>  out_free_vq:
>  	vdev->config->del_vqs(vdev);
> +	kfree(vblk->vqs);
>  out_free_vblk:
>  	kfree(vblk);
>  out_free_index:
> -- 
> 2.25.0.4.g0ad7144999
> 

The patch LGTM:

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe()
  2020-06-15  7:32 ` Stefano Garzarella
@ 2020-06-29  4:28   ` Hou Tao
  0 siblings, 0 replies; 5+ messages in thread
From: Hou Tao @ 2020-06-29  4:28 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Stefano Garzarella, linux-block, virtualization, Stefan Hajnoczi,
	Paolo Bonzini, Ming Lei

ping ?

On 2020/6/15 15:32, Stefano Garzarella wrote:
> On Mon, Jun 15, 2020 at 12:14:59PM +0800, Hou Tao wrote:
>> Else there will be memory leak if alloc_disk() fails.
>>
>> Fixes: 6a27b656fc02 ("block: virtio-blk: support multi virt queues per virtio-blk device")
>> Signed-off-by: Hou Tao <houtao1@huawei.com>
>> ---
>>  drivers/block/virtio_blk.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
>> index 9d21bf0f155e..980df853ee49 100644
>> --- a/drivers/block/virtio_blk.c
>> +++ b/drivers/block/virtio_blk.c
>> @@ -878,6 +878,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>>  	put_disk(vblk->disk);
>>  out_free_vq:
>>  	vdev->config->del_vqs(vdev);
>> +	kfree(vblk->vqs);
>>  out_free_vblk:
>>  	kfree(vblk);
>>  out_free_index:
>> -- 
>> 2.25.0.4.g0ad7144999
>>
> 
> The patch LGTM:
> 
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe()
  2020-06-15  4:14 [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe() Hou Tao
  2020-06-15  7:32 ` Stefano Garzarella
@ 2020-06-30 22:30 ` Ming Lei
  2020-07-01  1:03 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Ming Lei @ 2020-06-30 22:30 UTC (permalink / raw)
  To: Hou Tao
  Cc: linux-block, virtualization, Stefan Hajnoczi, Paolo Bonzini, Jens Axboe

On Mon, Jun 15, 2020 at 12:14:59PM +0800, Hou Tao wrote:
> Else there will be memory leak if alloc_disk() fails.
> 
> Fixes: 6a27b656fc02 ("block: virtio-blk: support multi virt queues per virtio-blk device")
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
>  drivers/block/virtio_blk.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 9d21bf0f155e..980df853ee49 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -878,6 +878,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>  	put_disk(vblk->disk);
>  out_free_vq:
>  	vdev->config->del_vqs(vdev);
> +	kfree(vblk->vqs);
>  out_free_vblk:
>  	kfree(vblk);
>  out_free_index:
> -- 
> 2.25.0.4.g0ad7144999
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe()
  2020-06-15  4:14 [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe() Hou Tao
  2020-06-15  7:32 ` Stefano Garzarella
  2020-06-30 22:30 ` Ming Lei
@ 2020-07-01  1:03 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2020-07-01  1:03 UTC (permalink / raw)
  To: Hou Tao, linux-block, virtualization
  Cc: Stefan Hajnoczi, Paolo Bonzini, Ming Lei

On 6/14/20 10:14 PM, Hou Tao wrote:
> Else there will be memory leak if alloc_disk() fails.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-01  1:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15  4:14 [PATCH] virtio-blk: free vblk-vqs in error path of virtblk_probe() Hou Tao
2020-06-15  7:32 ` Stefano Garzarella
2020-06-29  4:28   ` Hou Tao
2020-06-30 22:30 ` Ming Lei
2020-07-01  1:03 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).