lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 12 Mar 2019 16:01:05 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Yue Haibing <yuehaibing@...wei.com>, mst@...hat.com
Cc:     linux-kernel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH] virtio_ring: Fix potential mem leak in
 virtqueue_add_indirect_packed


On 2019/3/12 下午3:06, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@...wei.com>
>
> 'desc' should be freed before leaving from err handing path.
>
> Fixes: 1ce9e6055fa0 ("virtio_ring: introduce packed ring support")
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> ---
>   drivers/virtio/virtio_ring.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index a0b07c3..9d95d9c 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -991,6 +991,7 @@ static int virtqueue_add_indirect_packed(struct vring_virtqueue *vq,
>   
>   	if (unlikely(vq->vq.num_free < 1)) {
>   		pr_debug("Can't add buf len 1 - avail = 0\n");
> +		kfree(desc);
>   		END_USE(vq);
>   		return -ENOSPC;
>   	}


Or you can move the check before the allocation.

Acked-by: Jason Wang <jasowang@...hat.com>

Please cc stable next time.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ