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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 2 Aug 2016 17:04:16 +0300
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	Wei Yongjun <weiyj.lk@...il.com>
Cc:	virtualization@...ts.linux-foundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] virtio: fix possible memory leak in virtqueue_add()

On Tue, Aug 02, 2016 at 01:59:05PM +0000, Wei Yongjun wrote:
> desc may malloced in virtqueue_add() and should be freed before
> leaving from the error handling cases, otherwise it will cause
> memory leak.
> 
> Signed-off-by: Wei Yongjun <weiyj.lk@...il.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 114a0c8..bda71ef 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -328,6 +328,7 @@ static inline int virtqueue_add(struct virtqueue *_vq,
>  		if (out_sgs)
>  			vq->notify(&vq->vq);
>  		END_USE(vq);
> +		kfree(desc);

I think only if indirect is true, otherwise you will free
vq->vring.desc.

>  		return -ENOSPC;
>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ