OSDN Git Service

usb: gadget: composite: avoid kernel oops with bad gadgets
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 22 Apr 2016 11:53:47 +0000 (14:53 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 28 Apr 2016 06:02:00 +0000 (09:02 +0300)
commit0878263b68df372e6389b050fc2bd4f6d5b9f332
treef57265071ca2d3db34d6eff077b2fe3708660044
parentce046d323d74ee9d280688a2cb499716f555a89f
usb: gadget: composite: avoid kernel oops with bad gadgets

If a gadget driver loaded to a Superspeed-capable
peripheral controller, using a Superspeed cable,
doesn't provide Superspeed descriptors, we will get
a NULL pointer dereference.

In order to avoid that situation, we will try to
find any valid descriptors we can. If no set of
descriptors is passed in, then we'll let that gadget
oops anyhow.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/composite.c