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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  8 Sep 2022 21:42:14 -0700
From:   Li Zhong <floridsleeves@...il.com>
To:     linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Cc:     heghedus.razvan@...il.com, evgreen@...omium.org,
        yuanjilin@...rlc.com, stern@...land.harvard.edu,
        jj251510319013@...il.com, gregkh@...uxfoundation.org,
        Li Zhong <floridsleeves@...il.com>
Subject: [PATCH v1] drivers/usb/core/driver: check return value of usb_set_interface()

Check return value of usb_set_interface() and report error if it fails.
Otherwise usb_set_interface() may fail without any warnings. 

This flaw was found using an experimental static analysis tool we are
developing. Report warnings when the function usb_set_interface() fails
can increase the dianosability.

Signed-off-by: Li Zhong <floridsleeves@...il.com>
---
 drivers/usb/core/driver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 7e7e119c253f..ee375b5eafe6 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1332,8 +1332,10 @@ static int usb_resume_interface(struct usb_device *udev,
 
 		/* Carry out a deferred switch to altsetting 0 */
 		if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) {
-			usb_set_interface(udev, intf->altsetting[0].
-					desc.bInterfaceNumber, 0);
+			status = usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0);
+			if (status < 0)
+				dev_err(intf->dev, "usb_set_interface error %d\n",
+							status);
 			intf->needs_altsetting0 = 0;
 		}
 		goto done;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ