From mhund@ld-didactic.de Wed Jul 13 11:30:50 2005 Message-ID: <42D554E7.8060305@ld-didactic.de> Date: Wed, 13 Jul 2005 19:52:39 +0200 From: Michael Hund To: gregkh@suse.de Cc: "Hund, Dr. Michael" Subject: USB: ldusb fixes below you will find the forgotten kmalloc check (sorry). Signed-off-by: Michael Hund Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/ldusb.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) --- gregkh-2.6.orig/drivers/usb/misc/ldusb.c 2005-07-13 09:45:06.000000000 -0700 +++ gregkh-2.6/drivers/usb/misc/ldusb.c 2005-07-27 16:26:18.000000000 -0700 @@ -23,6 +23,7 @@ * * V0.1 (mh) Initial version * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) + * V0.12 (mh) Added kmalloc check for string buffer */ #include @@ -84,7 +85,7 @@ { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, ld_usb_table); -MODULE_VERSION("V0.11"); +MODULE_VERSION("V0.12"); MODULE_AUTHOR("Michael Hund "); MODULE_DESCRIPTION("LD USB Driver"); MODULE_LICENSE("GPL"); @@ -635,6 +636,10 @@ (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { buffer = kmalloc(256, GFP_KERNEL); + if (buffer == NULL) { + dev_err(&intf->dev, "Couldn't allocate string buffer\n"); + goto error; + } /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ usb_string(udev, 255, buffer, 256); kfree(buffer);