[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1578512578.71487032@decadent.org.uk>
Date: Wed, 08 Jan 2020 19:43:15 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
"Peter Chen" <peter.chen@....com>, "Arnd Bergmann" <arnd@...db.de>,
"Felipe Balbi" <felipe.balbi@...ux.intel.com>
Subject: [PATCH 3.16 17/63] usb: gadget: composite: fix dereference after
null check coverify warning
3.16.81-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chen <peter.chen@....com>
commit c526c62d565ea5a5bba9433f28756079734f430d upstream.
cdev->config is checked for null pointer at above code, so cdev->config
might be null, fix it by adding null pointer check.
Signed-off-by: Peter Chen <peter.chen@....com>
Signed-off-by: Felipe Balbi <felipe.balbi@...ux.intel.com>
Cc: Arnd Bergmann <arnd@...db.de>
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/usb/gadget/composite.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1729,6 +1729,8 @@ unknown:
break;
case USB_RECIP_ENDPOINT:
+ if (!cdev->config)
+ break;
endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
list_for_each_entry(f, &cdev->config->functions, list) {
if (test_bit(endp, f->endpoints))
Powered by blists - more mailing lists