usb: renesas_usbhs: return error if wrong recip request
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 21 Apr 2011 05:10:12 +0000 (14:10 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 30 Apr 2011 00:24:32 +0000 (17:24 -0700)
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 <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/renesas_usbhs/mod_gadget.c

index d027c80ab3599bd58a3cdadb0c389fdc76904a99..206cfabc92863e0d409e8c76a32bf3129883eeda 100644 (file)
@@ -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: