]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/usb-gadget-composite-fix-dereference-after-null-check-coverify-warning.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / usb-gadget-composite-fix-dereference-after-null-check-coverify-warning.patch
1 From c526c62d565ea5a5bba9433f28756079734f430d Mon Sep 17 00:00:00 2001
2 From: Peter Chen <peter.chen@nxp.com>
3 Date: Fri, 1 Jul 2016 15:33:28 +0800
4 Subject: usb: gadget: composite: fix dereference after null check coverify warning
5
6 From: Peter Chen <peter.chen@nxp.com>
7
8 commit c526c62d565ea5a5bba9433f28756079734f430d upstream.
9
10 cdev->config is checked for null pointer at above code, so cdev->config
11 might be null, fix it by adding null pointer check.
12
13 Signed-off-by: Peter Chen <peter.chen@nxp.com>
14 Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
15 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 drivers/usb/gadget/composite.c | 2 ++
20 1 file changed, 2 insertions(+)
21
22 --- a/drivers/usb/gadget/composite.c
23 +++ b/drivers/usb/gadget/composite.c
24 @@ -1819,6 +1819,8 @@ unknown:
25 break;
26
27 case USB_RECIP_ENDPOINT:
28 + if (!cdev->config)
29 + break;
30 endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
31 list_for_each_entry(f, &cdev->config->functions, list) {
32 if (test_bit(endp, f->endpoints))