Skip to content

Commit

Permalink
usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
Browse files Browse the repository at this point in the history
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: 2f98382 (usb: renesas_usbhs: Add Renesas USBHS Gadget)
Cc: <stable@vger.kernel.org> # v3.0+
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Kazuya Mizuguchi authored and Felipe Balbi committed Nov 5, 2014
1 parent c3761a7 commit 1143205
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/renesas_usbhs/mod_gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep)
struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep);

if (!pipe)
return -EINVAL;

usbhsg_pipe_disable(uep);
usbhs_pipe_free(pipe);

Expand Down

0 comments on commit 1143205

Please sign in to comment.