Re: [PATCH 057/144] usb: musb: gadget: prevent a NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2011-01-09 at 20:17 +0300, Sergei Shtylyov wrote:
> > Which means that gadget drivers testing for valid struct usb_request *
> > pointers against NULL will be fooled thinking it got a valid struct
> > usb_request *, which is a mistake.
> 
>     How, if the 'request' field is the first field in the 'struct musb_request'?

someone could add a field before it.

> > So the potential for kernel oops is valid, my commit log might not have
> > been the brightest though :-p
> 
>     Only a potential -- if we actually move the 'request' field.   ..

exactly. The code should work even if request isn't the first field.
Ideally it would always be. It would actually make container_of() be
optimized to a simple type cast.

-- 
balbi

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux