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:	Thu, 16 Nov 2006 18:57:28 +0100
From:	Mariusz Kozlowski <m.kozlowski@...land.pl>
To:	Greg KH <greg@...ah.com>
Cc:	linux-usb-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: [PATCH] usb: microtek possible memleak fix

Hello,

	This should fix possible memory leak in mts_usb_probe() on error path.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@...land.pl>

 drivers/usb/image/microtek.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

--- linux-2.6.19-rc5-mm2-a/drivers/usb/image/microtek.c	2006-11-08 03:24:20.000000000 +0100
+++ linux-2.6.19-rc5-mm2-b/drivers/usb/image/microtek.c	2006-11-16 18:47:41.000000000 +0100
@@ -788,15 +788,15 @@ static int mts_usb_probe(struct usb_inte
 
 	new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL);
 	if (!new_desc)
-		goto out;
+		goto err_0;
 
 	new_desc->urb = usb_alloc_urb(0, GFP_KERNEL);
 	if (!new_desc->urb)
-		goto out_kfree;
+		goto err_1;
 
 	new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL);
 	if (!new_desc->context.scsi_status)
-		goto out_kfree2;
+		goto err_2;
 
 	new_desc->usb_dev = dev;
 	new_desc->usb_intf = intf;
@@ -822,25 +822,27 @@ static int mts_usb_probe(struct usb_inte
 	new_desc->host = scsi_host_alloc(&mts_scsi_host_template,
 			sizeof(new_desc));
 	if (!new_desc->host)
-		goto out_free_urb;
+		goto err_3;
 
 	new_desc->host->hostdata[0] = (unsigned long)new_desc;
 	if (scsi_add_host(new_desc->host, NULL)) {
 		err_retval = -EIO;
-		goto out_free_urb;
+		goto err_4;
 	}
 	scsi_scan_host(new_desc->host);
 
 	usb_set_intfdata(intf, new_desc);
 	return 0;
 
- out_kfree2:
+err_4:
+	scsi_host_put(new_desc->host);
+err_3:
 	kfree(new_desc->context.scsi_status);
- out_free_urb:
+err_2:
 	usb_free_urb(new_desc->urb);
- out_kfree:
+err_1:
 	kfree(new_desc);
- out:
+err_0:
 	return err_retval;
 }
 


-- 
Regards,

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