]>
Commit | Line | Data |
---|---|---|
878e5d04 GKH |
1 | From 11432050f070810ba139d0226344eef120c3a559 Mon Sep 17 00:00:00 2001 |
2 | From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com> | |
3 | Date: Tue, 4 Nov 2014 10:05:42 +0900 | |
4 | Subject: usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable() | |
5 | ||
6 | From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com> | |
7 | ||
8 | commit 11432050f070810ba139d0226344eef120c3a559 upstream. | |
9 | ||
10 | This patch fixes an issue that the NULL pointer dereference happens | |
11 | when we uses g_audio driver. Since the g_audio driver will call | |
12 | usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(), | |
13 | the uep->pipe of renesas usbhs driver will be NULL. So, this patch | |
14 | adds a condition to avoid the oops. | |
15 | ||
16 | Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com> | |
17 | Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> | |
18 | Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | |
19 | Fixes: 2f98382dc (usb: renesas_usbhs: Add Renesas USBHS Gadget) | |
20 | Signed-off-by: Felipe Balbi <balbi@ti.com> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | ||
23 | --- | |
24 | drivers/usb/renesas_usbhs/mod_gadget.c | 3 +++ | |
25 | 1 file changed, 3 insertions(+) | |
26 | ||
27 | --- a/drivers/usb/renesas_usbhs/mod_gadget.c | |
28 | +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |
29 | @@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_ | |
30 | struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); | |
31 | struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); | |
32 | ||
33 | + if (!pipe) | |
34 | + return -EINVAL; | |
35 | + | |
36 | usbhsg_pipe_disable(uep); | |
37 | usbhs_pipe_free(pipe); | |
38 |