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]
Date:	Mon, 3 Jan 2011 00:12:16 +0100 (CET)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Jesper Juhl <jj@...osbits.net>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Bruno Prémont <bonbons@...ux-vserver.org>,
	"Rick L. Vinyard, Jr." <rvinyard@...nmsu.edu>
Subject: Re: [PATCH] HID, hid-picolcd: Fix memory leak in
 picolcd_debug_out_report()

On Sun, 2 Jan 2011, Jesper Juhl wrote:

> We have a memory leak in 
> drivers/hid/hid-picolcd.c::picolcd_debug_out_report() in an error path..
> We are not always freeing the memory allocated to 'buff' - this patch 
> makes sure we always kfree() what we allocate with kmalloc() when it is 
> no longer needed.
> 
> 
> Signed-off-by: Jesper Juhl <jj@...osbits.net>
> ---
>  hid-picolcd.c |    1 +
>  1 file changed, 1 insertion(+)
> 
>   compile tested only.
> 
> diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
> index bc2e077..ad6539a 100644
> --- a/drivers/hid/hid-picolcd.c
> +++ b/drivers/hid/hid-picolcd.c
> @@ -1867,6 +1867,7 @@ static void picolcd_debug_out_report(struct picolcd_data *data,
>  			report->id, raw_size);
>  	hid_debug_event(hdev, buff);
>  	if (raw_size + 5 > sizeof(raw_data)) {
> +		kfree(buff);
>  		hid_debug_event(hdev, " TOO BIG\n");
>  		return;
>  	} else {
> 

Good catch, applied, thanks Jesper.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
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