]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
authorKazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Tue, 4 Nov 2014 01:05:42 +0000 (10:05 +0900)
committerZefan Li <lizefan@huawei.com>
Tue, 14 Apr 2015 09:33:41 +0000 (17:33 +0800)
commit 11432050f070810ba139d0226344eef120c3a559 upstream.

This patch fixes an issue that the NULL pointer dereference happens
when we uses g_audio driver. Since the g_audio driver will call
usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(),
the uep->pipe of renesas usbhs driver will be NULL. So, this patch
adds a condition to avoid the oops.

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fixes: 2f98382dc (usb: renesas_usbhs: Add Renesas USBHS Gadget)
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/renesas_usbhs/mod_gadget.c

index 00bd2a5e0362b97fc13c00936b1ebc7efa660f02..056dc6e4a9f94b080364fda6564383b068dc75e5 100644 (file)
@@ -672,6 +672,9 @@ static int __usbhsg_ep_set_halt_wedge(struct usb_ep *ep, int halt, int wedge)
        struct device *dev = usbhsg_gpriv_to_dev(gpriv);
        unsigned long flags;
 
+       if (!pipe)
+               return -EINVAL;
+
        usbhsg_pipe_disable(uep);
 
        dev_dbg(dev, "set halt %d (pipe %d)\n",