2004-09-27 22:17:41

by Jesse Barnes

[permalink] [raw]
Subject: [PATCH] handle usb host allocation failures

It looks like a host (like ohci or whatever) could try to allocate a new
usb_device structure with usb_alloc_dev and get back a valid pointer even if
the allocation of its private data failed. I first saw this in the 2.4
sources, but it looks like 2.6 has the same problem. This patch attempts to
fix it by freeing dev if the ->allocate() routine fails, and then returns
NULL instead of a potentially dangerous dev pointer.

Signed-off-by: Jesse Barnes <[email protected]>

Thanks,
Jesse


Attachments:
(No filename) (493.00 B)
usb-alloc-dev-nomem.patch (383.00 B)
Download all attachments

2004-09-29 23:29:30

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] handle usb host allocation failures

On Mon, Sep 27, 2004 at 03:17:32PM -0700, Jesse Barnes wrote:
> It looks like a host (like ohci or whatever) could try to allocate a new
> usb_device structure with usb_alloc_dev and get back a valid pointer even if
> the allocation of its private data failed. I first saw this in the 2.4
> sources, but it looks like 2.6 has the same problem. This patch attempts to
> fix it by freeing dev if the ->allocate() routine fails, and then returns
> NULL instead of a potentially dangerous dev pointer.
>
> Signed-off-by: Jesse Barnes <[email protected]>

Applied, thanks.

greg k-h