From: "Indan Zupancic" <indan@nul.nu>
To: "Greg KH" <greg@kroah.com>
Cc: "Christoph Lameter" <clameter@sgi.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [BUG: 2.6.22-rc2] SLAB doesn't like usb_get_configuration()
Date: Sun, 20 May 2007 00:10:47 +0200 (CEST) [thread overview]
Message-ID: <1447.81.207.0.53.1179612647.squirrel@secure.samage.net> (raw)
In-Reply-To: <20070519193307.GA26156@kroah.com>
On Sat, May 19, 2007 21:33, Greg KH wrote:
> On Sat, May 19, 2007 at 11:20:44AM -0700, Christoph Lameter wrote:
>> On Sat, 19 May 2007, Indan Zupancic wrote:
>>
>> > I had two SLAb related bugs, both with usb_get_configuration()
>> > near the end of the backtrace. First one was with git between
>> > rc1 and rc2, but very close to rc2, second one was with rc2,
>> > both at bootup.
>>
>> Well usb_get_configuration seems to do a kmalloc(0) which is a bit
>> strange and this is why we flagged the allocation in the slab allocators.
>> Is there some way to avoid allocating an object of zero length?
>
> Can you try the patch below and let me know if it fixes the issue for
> you or not?
>
> thanks,
>
> greg k-h
>
>
> From: Alan Stern <stern@rowland.harvard.edu>
> Subject: [PATCH] USB: don't try to kzalloc 0 bytes
>
> This patch (as907) prevents us from trying to allocate 0 bytes
> when an interface has no endpoint descriptors.
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
>
> --- usb-2.6.orig/drivers/usb/core/config.c
> +++ usb-2.6/drivers/usb/core/config.c
> @@ -185,10 +185,12 @@ static int usb_parse_interface(struct de
> num_ep = USB_MAXENDPOINTS;
> }
>
> - len = sizeof(struct usb_host_endpoint) * num_ep;
> - alt->endpoint = kzalloc(len, GFP_KERNEL);
> - if (!alt->endpoint)
> - return -ENOMEM;
> + if (num_ep > 0) { /* Can't allocate 0 bytes */
> + len = sizeof(struct usb_host_endpoint) * num_ep;
> + alt->endpoint = kzalloc(len, GFP_KERNEL);
> + if (!alt->endpoint)
> + return -ENOMEM;
> + }
>
> /* Parse all the endpoint descriptors */
> n = 0;
>
Thanks, this one seems to fix it, I don't get the BUG anymore.
Greetings,
Indan
next prev parent reply other threads:[~2007-05-19 22:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-19 5:17 Linux 2.6.22-rc2 Linus Torvalds
2007-05-19 6:54 ` Andrey Borzenkov
2007-05-19 14:28 ` [BUG: 2.6.22-rc2] SLAB doesn't like usb_get_configuration() Indan Zupancic
[not found] ` <6101e8c40705190950jb093d65l611995895a182ec0@mail.gmail.com>
2007-05-19 16:51 ` Fwd: " oliver pinter
2007-05-19 18:20 ` Christoph Lameter
2007-05-19 19:33 ` Greg KH
2007-05-19 22:10 ` Indan Zupancic [this message]
2007-05-20 12:57 ` Linux 2.6.22-rc2: make -j makes it unresponsive Rafael J. Wysocki
2007-05-20 13:01 ` Krzysztof Halasa
2007-05-20 13:23 ` Rafael J. Wysocki
2007-05-20 21:05 ` Linux 2.6.22-rc2 Mike Houston
2007-05-21 15:45 ` Stephen Hemminger
2007-05-21 17:10 ` Mike Houston
2007-05-21 17:37 ` Stephen Hemminger
2007-05-22 2:58 ` Mike Houston
2007-05-22 4:31 ` Stephen Hemminger
2007-05-22 4:36 ` Jeff Garzik
2007-05-22 4:42 ` Stephen Hemminger
2007-05-22 5:04 ` Linus Torvalds
2007-05-22 17:19 ` Stephen Hemminger
2007-05-22 17:54 ` H. Peter Anvin
2007-05-22 22:14 ` Mike Houston
2007-05-23 0:00 ` Linus Torvalds
2007-05-23 0:29 ` Stephen Hemminger
2007-05-23 1:53 ` Linus Torvalds
2007-05-23 14:58 ` Stephen Hemminger
2007-05-23 17:39 ` Mike Houston
2007-05-23 17:46 ` Linus Torvalds
2007-05-23 18:04 ` Stephen Hemminger
2007-05-24 18:26 ` Mike Houston
2007-05-24 22:08 ` sky2/pci issues on Gigabyte Stephen Hemminger
2007-05-24 22:48 ` Linus Torvalds
2007-05-24 23:04 ` Stephen Hemminger
2007-05-25 0:01 ` Mike Houston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1447.81.207.0.53.1179612647.squirrel@secure.samage.net \
--to=indan@nul.nu \
--cc=clameter@sgi.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome