This patch adds missing class_device_create() error check,
and makes notifier return NOTIFY_BAD.
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
drivers/usb/core/devio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: work-fault-inject/drivers/usb/core/devio.c
===================================================================
--- work-fault-inject.orig/drivers/usb/core/devio.c 2006-10-09 15:06:27.000000000 +0900
+++ work-fault-inject/drivers/usb/core/devio.c 2006-10-09 15:09:23.000000000 +0900
@@ -1588,15 +1588,18 @@ const struct file_operations usbfs_devic
.release = usbdev_release,
};
-static void usbdev_add(struct usb_device *dev)
+static int usbdev_add(struct usb_device *dev)
{
int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
dev->class_dev = class_device_create(usb_device_class, NULL,
MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
"usbdev%d.%d", dev->bus->busnum, dev->devnum);
+ if (IS_ERR(dev->class_dev))
+ return PTR_ERR(dev->class_dev);
dev->class_dev->class_data = dev;
+ return 0;
}
static void usbdev_remove(struct usb_device *dev)
@@ -1609,7 +1612,8 @@ static int usbdev_notify(struct notifier
{
switch (action) {
case USB_DEVICE_ADD:
- usbdev_add(dev);
+ if (usbdev_add(dev))
+ return NOTIFY_BAD;
break;
case USB_DEVICE_REMOVE:
usbdev_remove(dev);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]