This is a note to let you know that I've just added the patch titled
Subject: gadgetfs: fix memory leaks
to my gregkh-2.6 tree. Its filename is
gadgetfs-fix-memory-leaks.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From [EMAIL PROTECTED] Mon May 22 09:27:46 2006
Date: Mon, 22 May 2006 12:27:38 -0400 (EDT)
From: Alan Stern <[EMAIL PROTECTED]>
To: Greg KH <[EMAIL PROTECTED]>, David Brownell <[EMAIL PROTECTED]>
cc: USB development list <[email protected]>
Subject: gadgetfs: fix memory leaks
Message-ID: <[EMAIL PROTECTED]>
This patch (as692) fixes a few memory leaks in some unimportant error
pathways of the gadgetfs driver.
Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Acked-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
drivers/usb/gadget/inode.c | 51 +++++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 22 deletions(-)
--- gregkh-2.6.orig/drivers/usb/gadget/inode.c
+++ gregkh-2.6/drivers/usb/gadget/inode.c
@@ -1038,7 +1038,7 @@ scan:
/* ep0 can't deliver events when STATE_SETUP */
for (i = 0; i < n; i++) {
if (dev->event [i].type == GADGETFS_SETUP) {
- len = n = i + 1;
+ len = i + 1;
len *= sizeof (struct usb_gadgetfs_event);
n = 0;
break;
@@ -1586,13 +1586,13 @@ gadgetfs_create_file (struct super_block
static int activate_ep_files (struct dev_data *dev)
{
struct usb_ep *ep;
+ struct ep_data *data;
gadget_for_each_ep (ep, dev->gadget) {
- struct ep_data *data;
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
- goto enomem;
+ goto enomem0;
data->state = STATE_EP_DISABLED;
init_MUTEX (&data->lock);
init_waitqueue_head (&data->wait);
@@ -1607,21 +1607,23 @@ static int activate_ep_files (struct dev
data->req = usb_ep_alloc_request (ep, GFP_KERNEL);
if (!data->req)
- goto enomem;
+ goto enomem1;
data->inode = gadgetfs_create_file (dev->sb, data->name,
data, &ep_config_operations,
&data->dentry);
- if (!data->inode) {
- usb_ep_free_request(ep, data->req);
- kfree (data);
- goto enomem;
- }
+ if (!data->inode)
+ goto enomem2;
list_add_tail (&data->epfiles, &dev->epfiles);
}
return 0;
-enomem:
+enomem2:
+ usb_ep_free_request (ep, data->req);
+enomem1:
+ put_dev (dev);
+ kfree (data);
+enomem0:
DBG (dev, "%s enomem\n", __FUNCTION__);
destroy_ep_files (dev);
return -ENOMEM;
@@ -1792,7 +1794,7 @@ static struct usb_gadget_driver probe_dr
*
* After initialization, the device stays active for as long as that
* $CHIP file is open. Events may then be read from that descriptor,
- * such configuration notifications. More complex drivers will handle
+ * such as configuration notifications. More complex drivers will handle
* some control requests in user space.
*/
@@ -2032,12 +2034,10 @@ gadgetfs_fill_super (struct super_block
NULL, &simple_dir_operations,
S_IFDIR | S_IRUGO | S_IXUGO);
if (!inode)
- return -ENOMEM;
+ goto enomem0;
inode->i_op = &simple_dir_inode_operations;
- if (!(d = d_alloc_root (inode))) {
- iput (inode);
- return -ENOMEM;
- }
+ if (!(d = d_alloc_root (inode)))
+ goto enomem1;
sb->s_root = d;
/* the ep0 file is named after the controller we expect;
@@ -2045,21 +2045,28 @@ gadgetfs_fill_super (struct super_block
*/
dev = dev_new ();
if (!dev)
- return -ENOMEM;
+ goto enomem2;
dev->sb = sb;
- if (!(inode = gadgetfs_create_file (sb, CHIP,
+ if (!gadgetfs_create_file (sb, CHIP,
dev, &dev_init_operations,
- &dev->dentry))) {
- put_dev(dev);
- return -ENOMEM;
- }
+ &dev->dentry))
+ goto enomem3;
/* other endpoint files are available after hardware setup,
* from binding to a controller.
*/
the_device = dev;
return 0;
+
+enomem3:
+ put_dev (dev);
+enomem2:
+ dput (d);
+enomem1:
+ iput (inode);
+enomem0:
+ return -ENOMEM;
}
/* "mount -t gadgetfs path /dev/gadget" ends up here */
Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are
usb/uhci-reimplement-fsbr.patch
usb/uhci-eliminate-the-td-removal-list.patch
usb/uhci-work-around-old-intel-bug.patch
usb/usb-usbcore-always-turn-on-hub-port-power.patch
usb/usbhid-automatically-set-hid_quirk_noget-for-keyboards-and-mice.patch
usb/uhci-common-result-routine-for-control-bulk-interrupt.patch
usb/uhci-move-code-for-cleaning-up-unlinked-urbs.patch
usb/usb-net2280-add-a-shutdown-routine.patch
usb/usb-uhci-fix-obscure-bug-in-enqueue.patch
usb/usb-uhci-store-the-endpoint-type-in-the-qh-structure.patch
usb/uhci-remove-non-iso-tds-as-they-are-used.patch
usb/uhci-fix-race-in-iso-dequeuing.patch
usb/uhci-remove-iso-tds-as-they-are-used.patch
usb/uhci-store-the-period-in-the-queue-header.patch
usb/uhci-use-integer-sized-frame-numbers.patch
usb/usb-print-message-when-device-is-rejected-due-to-insufficient-power.patch
usb/usb-storage-get-rid-of-the-timer-during-urb-submission.patch
usb/usbcore-fix-broken-rndis-config-selection.patch
usb/usbtest-report-errors-in-iso-tests.patch
usb/usbhid-remove-unneeded-blacklist-entries.patch
usb/gadgetfs-fix-aio-interface-bugs.patch
usb/gadgetfs-fix-memory-leaks.patch
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel