From: Kuninori Morimoto Date: Thu, 21 Apr 2011 05:10:12 +0000 (+0900) Subject: usb: renesas_usbhs: return error if wrong recip request X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=9a28b7bd4f1fb388a15b12fb425a589ba6188425;p=deliverable%2Flinux.git usb: renesas_usbhs: return error if wrong recip request There are some USB Host which doesn't notice disconnection at once. And it might try some request after reconnection with old settings. Current renesas_usbhs will crash in such case. This patch prevent this issue. Signed-off-by: Kuninori Morimoto Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index d027c80ab359..206cfabc9286 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -583,6 +583,10 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv, char *msg; uep = usbhsg_gpriv_to_nth_uep(gpriv, nth); + if (!usbhsg_uep_to_pipe(uep)) { + dev_err(dev, "wrong recip request\n"); + return -EINVAL; + } switch (recip) { case USB_RECIP_DEVICE: