Re: [PATCH][hid] Fix a NULL pointer dereference when we fail toallocate memory

From: Jiri Kosina
Date: Mon Jul 30 2007 - 09:21:56 EST


On Sun, 22 Jul 2007, Jesper Juhl wrote:

> 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...

Hi Jesper,

thanks a lot for noticing this, I have queued your patch in HID tree.

(and sorry for late reply, I was offline on vacation for some time).

--
Jiri Kosina
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/