Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1581536
| From | Bart Van Assche <Bart.VanAssche@sandisk.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] scsi, block: fix memory leak of sdpk on when gd fails to allocate |
| Date | 2017-02-15 19:20 +0100 |
| Message-ID | <tbclk-3oS-27@gated-at.bofh.it> (permalink) |
| References | <t6S1Q-698-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 2017-02-03 at 19:38 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.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.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH] scsi, block: fix memory leak of sdpk on when gd fails to allocate Bart Van Assche <Bart.VanAssche@sandisk.com> - 2017-02-15 19:20 +0100
csiph-web