]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.18.3/usb-renesas_usbhs-gadget-fix-null-pointer-dereference-in-ep_disable.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.18.3 / usb-renesas_usbhs-gadget-fix-null-pointer-dereference-in-ep_disable.patch
CommitLineData
878e5d04
GKH
1From 11432050f070810ba139d0226344eef120c3a559 Mon Sep 17 00:00:00 2001
2From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
3Date: Tue, 4 Nov 2014 10:05:42 +0900
4Subject: usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
5
6From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
7
8commit 11432050f070810ba139d0226344eef120c3a559 upstream.
9
10This patch fixes an issue that the NULL pointer dereference happens
11when we uses g_audio driver. Since the g_audio driver will call
12usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(),
13the uep->pipe of renesas usbhs driver will be NULL. So, this patch
14adds a condition to avoid the oops.
15
16Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
17Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
18Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
19Fixes: 2f98382dc (usb: renesas_usbhs: Add Renesas USBHS Gadget)
20Signed-off-by: Felipe Balbi <balbi@ti.com>
21Signed-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