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: <20140415093305.GE8753@valkosipuli.retiisi.org.uk>
Date:	Tue, 15 Apr 2014 12:33:06 +0300
From:	Sakari Ailus <sakari.ailus@....fi>
To:	Daeseok Youn <daeseok.youn@...il.com>
Cc:	m.chehab@...sung.com, linux-dev@...soray.com,
	hans.verkuil@...co.com, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [media] s2255drv: fix memory leak s2255_probe()

Hi Daeseok,

On Tue, Apr 15, 2014 at 01:49:34PM +0900, Daeseok Youn wrote:
> 
> smatch says:
>  drivers/media/usb/s2255/s2255drv.c:2246 s2255_probe() warn:
> possible memory leak of 'dev'
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
> ---
>  drivers/media/usb/s2255/s2255drv.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
> index 1d4ba2b..8aca3ef 100644
> --- a/drivers/media/usb/s2255/s2255drv.c
> +++ b/drivers/media/usb/s2255/s2255drv.c
> @@ -2243,6 +2243,7 @@ static int s2255_probe(struct usb_interface *interface,
>  	dev->cmdbuf = kzalloc(S2255_CMDBUF_SIZE, GFP_KERNEL);
>  	if (dev->cmdbuf == NULL) {
>  		s2255_dev_err(&interface->dev, "out of memory\n");
> +		kfree(dev);
>  		return -ENOMEM;
>  	}
>  

The rest of the function already uses goto and labels for error handling. I
think it'd take adding one more. dev is correctly released in other error
cases.

What do you think?

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@....fi	XMPP: sailus@...iisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ