ChangeSet 1.831.15.10, 2002/12/09 10:05:28-08:00, [EMAIL PROTECTED]
[PATCH] USB usbfs: fix race between disconnect and usbdev_open
diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c Mon Dec 9 11:41:16 2002
+++ b/drivers/usb/core/devio.c Mon Dec 9 11:41:16 2002
@@ -484,14 +484,17 @@
* and the hub thread have the kernel lock
* (still acquire the kernel lock for safety)
*/
+ ret = -ENOMEM;
+ if (!(ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL)))
+ goto out_nolock;
+
lock_kernel();
ret = -ENOENT;
dev = inode->u.generic_ip;
- if (!dev)
- goto out;
- ret = -ENOMEM;
- if (!(ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL)))
+ if (!dev) {
+ kfree(ps);
goto out;
+ }
ret = 0;
ps->dev = dev;
ps->file = file;
@@ -509,6 +512,7 @@
file->private_data = ps;
out:
unlock_kernel();
+ out_nolock:
return ret;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel