* [PATCH]resource leak in hiddev if autoresume fails
@ 2007-10-05 14:04 Oliver Neukum
0 siblings, 0 replies; only message in thread
From: Oliver Neukum @ 2007-10-05 14:04 UTC (permalink / raw)
To: Jiri Kosina, linux-input, linux-usb-devel
Hi,
several resources are not freed if autoresume fails.
Regards
Oliver
Signed-off-by: Oliver Neukum <oneukum@suse.de>
----
--- a/drivers/hid/usbhid/hiddev.c 2007-10-05 15:42:45.000000000 +0200
+++ b/drivers/hid/usbhid/hiddev.c 2007-10-05 15:54:32.000000000 +0200
@@ -280,18 +280,21 @@ static int hiddev_open(struct inode *ino
list->hiddev = hiddev_table[i];
- spin_lock_irqsave(&list->hiddev->list_lock, flags);
- list_add_tail(&list->node, &hiddev_table[i]->list);
- spin_unlock_irqrestore(&list->hiddev->list_lock, flags);
-
- file->private_data = list;
-
if (!list->hiddev->open++)
if (list->hiddev->exist) {
struct hid_device *hid = hiddev_table[i]->hid;
res = usbhid_get_power(hid);
- if (res < 0)
+ if (res < 0) {
+ hiddev_table[i]->open--;
+ kfree(list);
return -EIO;
+ } else {
+ spin_lock_irqsave(&list->hiddev->list_lock, flags);
+ list_add_tail(&list->node, &hiddev_table[i]->list);
+ spin_unlock_irqrestore(&list->hiddev->list_lock, flags);
+
+ file->private_data = list;
+ }
usbhid_open(hid);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-10-05 14:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05 14:04 [PATCH]resource leak in hiddev if autoresume fails Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).