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]
Message-ID: <1487181776.2666.7.camel@sandisk.com>
Date:   Wed, 15 Feb 2017 18:03:09 +0000
From:   Bart Van Assche <Bart.VanAssche@...disk.com>
To:     "jejb@...ux.vnet.ibm.com" <jejb@...ux.vnet.ibm.com>,
        "colin.king@...onical.com" <colin.king@...onical.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "axboe@...com" <axboe@...com>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] scsi, block: fix memory leak of sdpk on when gd fails
 to allocate

On Fri, 2017-02-03 at 19:38 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> On an allocation failure of gd, the current exit path is via out_free_devt
> which leaves sdpk still allocated and hence it gets leaked. Fix this by
> correcting the order of resource free'ing with a change in the error exit
> path labels.
> 
> Detected by CoverityScan, CID#1399519 ("Resource Leak")
> 
> Fixes: 0dba1314d4f81115dc ("scsi, block: fix duplicate bdi name registration crashes")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/scsi/sd.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index cb6e68d..99e1206 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -3213,10 +3213,10 @@ static int sd_probe(struct device *dev)
>  	sd_devt = NULL;
>   out_put:
>  	put_disk(gd);
> - out_free:
> -	kfree(sdkp);
>   out_free_devt:
>  	kfree(sd_devt);
> + out_free:
> +	kfree(sdkp);
>   out:
>  	scsi_autopm_put_device(sdp);
>  	return error;

Hello Colin,

This patch looks fine to me. But since it is a fix for a patch that exists
in Jens' tree and that is not yet upstream, please resubmit it to Jens.

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ