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]
Message-Id: <20241110125814.1899076-1-karprzy7@gmail.com>
Date: Sun, 10 Nov 2024 13:58:13 +0100
From: Karol Przybylski <karprzy7@...il.com>
To: hverkuil@...all.nl,
	mchehab@...nel.org
Cc: Karol Przybylski <karprzy7@...il.com>,
	linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	skhan@...uxfoundation.org
Subject: [PATCH] media: cec: extron-da-hd-4k-plus: add return check for wait_for_completion*()

According to scheduler/completion.rst, return status of wait_for_completion*()
function variants should be checked or be accompanied by explanation.

I examined code in extron-da-hd-4k-plus.c and it does look like the return value
should be checked, but perhaps there is a reason for ignoring it.
I drafted a patch for this, but I'm not entirely sure how to approach error handling in this case.

Discovered in coverity, CID1599679

Signed-off-by: Karol Przybylski <karprzy7@...il.com>
---
 .../cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
index cfbfc4c1b2e6..83a790117411 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
@@ -559,9 +559,12 @@ static void extron_read_edid(struct extron_port *port)
 
 	extron->edid_reading = true;
 
-	if (!extron_send_and_wait(extron, port, cmd, reply))
-		wait_for_completion_killable_timeout(&extron->edid_completion,
+	if (!extron_send_and_wait(extron, port, cmd, reply)) {
+		ret = wait_for_completion_killable_timeout(&extron->edid_completion,
 						     msecs_to_jiffies(1000));
+		if (ret < 0)
+			goto unlock;
+	}
 	if (port->edid_blocks) {
 		extron_parse_edid(port);
 		port->read_edid = true;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ