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]
Message-ID: <524db07f-2e88-5ae1-f748-4f86506eeeb6@oracle.com>
Date:   Tue, 31 Jul 2018 13:09:08 -0400
From:   Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:     Colin King <colin.king@...onical.com>,
        Juergen Gross <jgross@...e.com>, xen-devel@...ts.xenproject.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
        Oleksandr Andrushchenko <oleksandr_andrushchenko@...m.com>
Subject: Re: [PATCH][next] xen/gntdev: don't dereference a null gntdev_dmabuf
 on allocation failure

On 07/31/2018 10:02 AM, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> Currently when the allocation of gntdev_dmabuf fails, the error exit
> path will call dmabuf_imp_free_storage and causes a null pointer
> dereference on gntdev_dmabuf.  Fix this by adding an error exit path
> that won't free gntdev_dmabuf.
>
> Detected by CoverityScan, CID#1472124 ("Dereference after null check")
>
> Fixes: bf8dc55b1358 ("xen/gntdev: Implement dma-buf import functionality")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@...cle.com>

Applied to for-linus-4.19.



> ---
>  drivers/xen/gntdev-dmabuf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c
> index 744cfe9b0311..cba6b586bfbd 100644
> --- a/drivers/xen/gntdev-dmabuf.c
> +++ b/drivers/xen/gntdev-dmabuf.c
> @@ -568,7 +568,7 @@ static struct gntdev_dmabuf *dmabuf_imp_alloc_storage(int count)
>  
>  	gntdev_dmabuf = kzalloc(sizeof(*gntdev_dmabuf), GFP_KERNEL);
>  	if (!gntdev_dmabuf)
> -		goto fail;
> +		goto fail_no_free;
>  
>  	gntdev_dmabuf->u.imp.refs = kcalloc(count,
>  					    sizeof(gntdev_dmabuf->u.imp.refs[0]),
> @@ -591,6 +591,7 @@ static struct gntdev_dmabuf *dmabuf_imp_alloc_storage(int count)
>  
>  fail:
>  	dmabuf_imp_free_storage(gntdev_dmabuf);
> +fail_no_free:
>  	return ERR_PTR(-ENOMEM);
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ