2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 02:34:01 +08:00
linux-next/drivers/hid
Jesper Juhl de1a7b0328 USB HID: fix a possible NULL pointer dereference when we fail to allocate memory
If, in usb_hid_configure(), we fail to allocate storage for 'usbhid',
 "if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL)))",
then we'll jump to the 'fail:' label where we have this code:
        usb_free_urb(usbhid->urbin);
        usb_free_urb(usbhid->urbout);
        usb_free_urb(usbhid->urbctrl);
Since we got here because we couldn't allocate storage for 'usbhid',
what we have here is a NULL pointer dereference - ouch...

This patch solves that little problem by adding a new
'fail_no_usbhid:' label after the problematic calls to
usb_free_urb() and jumps to that one instead, in the problem case.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2007-08-02 13:48:03 +02:00
..
usbhid USB HID: fix a possible NULL pointer dereference when we fail to allocate memory 2007-08-02 13:48:03 +02:00
hid-core.c HID: make debugging output runtime-configurable 2007-07-09 14:03:35 +02:00
hid-debug.c HID: make debugging output runtime-configurable 2007-07-09 14:03:35 +02:00
hid-input.c Merge branches 'debug-module-param' and 'upstream' into for-linus 2007-07-09 14:23:37 +02:00
Kconfig Merge branches 'debug-module-param' and 'upstream' into for-linus 2007-07-09 14:23:37 +02:00
Makefile USB HID: move usbhid code from drivers/usb/input to drivers/hid/usbhid 2007-04-11 10:36:02 +02:00