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>] [day] [month] [year] [list]
Date:	Sun, 29 Jan 2012 21:55:28 +0100 (CET)
From:	Jesper Juhl <jj@...osbits.net>
To:	devel@...verdev.osuosl.org
cc:	linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
	"R.M. Thomas" <rmthomas@...olus.org>,
	Mauro Carvalho Chehab <mchehab@...radead.org>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Tomas Winkler <tomas.winkler@...el.com>,
	Dan Carpenter <error27@...il.com>
Subject: [PATCH] staging, media, easycap: Fix mem leak in
 easycap_usb_probe()

If allocating 'pdata_urb' fails, the function will return -ENOMEM
without freeing the memory allocated, just a few lines above, for
'purb' and will leak that memory when 'purb' goes out of scope.

This patch resolves the leak by freeing the allocated storage with
usb_free_urb() before the return.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 drivers/staging/media/easycap/easycap_main.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

  compile tested only

diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c
index 8ff5f38..3d439b7 100644
--- a/drivers/staging/media/easycap/easycap_main.c
+++ b/drivers/staging/media/easycap/easycap_main.c
@@ -3825,6 +3825,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 			pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL);
 			if (!pdata_urb) {
+				usb_free_urb(purb);
 				SAM("ERROR: Could not allocate struct data_urb.\n");
 				return -ENOMEM;
 			}
-- 
1.7.8.4


-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
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