[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0707301553240.26532@jikos.suse.cz>
Date: Mon, 30 Jul 2007 15:56:57 +0200 (CEST)
From: Jiri Kosina <jkosina@...e.cz>
To: Jiri Slaby <jirislaby@...il.com>
Cc: Jesper Juhl <jesper.juhl@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Michael Haboustak <mike-@...ci.rr.com>,
Andreas Gal <gal@....edu>, Greg Kroah-Hartman <greg@...ah.com>,
linux-input@...ey.karlin.mff.cuni.cz
Subject: Re: [PATCH][hid] Fix a NULL pointer dereference when we fail to
allocate memory
On Sun, 22 Jul 2007, Jiri Slaby wrote:
> > --- a/drivers/hid/usbhid/hid-core.c
> > +++ b/drivers/hid/usbhid/hid-core.c
> > @@ -743,7 +743,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
> > hid->quirks = quirks;
> >
> > if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL)))
> Out of curiosity, where is this freed?
I have queued the fix below on top of Jesper's patch, thanks.
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 3ff7468..6e73934 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -877,6 +877,7 @@ fail:
usb_free_urb(usbhid->urbin);
usb_free_urb(usbhid->urbout);
usb_free_urb(usbhid->urbctrl);
+ kfree(usbhid);
fail_no_usbhid:
hid_free_buffers(dev, hid);
hid_free_device(hid);
@@ -912,6 +913,7 @@ static void hid_disconnect(struct usb_interface *intf)
usb_free_urb(usbhid->urbin);
usb_free_urb(usbhid->urbctrl);
usb_free_urb(usbhid->urbout);
+ kfree(usbhid);
hid_free_buffers(hid_to_usb_dev(hid), hid);
hid_free_device(hid);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists