lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 22 Mar 2019 16:44:06 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     stable@...r.kernel.org, Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Peter Chen <peter.chen@....com>,
        Felipe Balbi <felipe.balbi@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Chunfeng Yun <chunfeng.yun@...iatek.com>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [BACKPORT 4.4.y 15/25] usb: gadget: composite: fix dereference after null check coverify warning

From: Peter Chen <peter.chen@....com>

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>
(cherry picked from commit c526c62d565ea5a5bba9433f28756079734f430d)
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/usb/gadget/composite.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 58f5fbdb6959..8bf54477f472 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1819,6 +1819,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))
-- 
2.20.0

Powered by blists - more mailing lists