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: <20240923092625.2673-1-kdipendra88@gmail.com>
Date: Mon, 23 Sep 2024 09:26:24 +0000
From: Dipendra Khadka <kdipendra88@...il.com>
To: heikki.krogerus@...ux.intel.com,
	gregkh@...uxfoundation.org
Cc: Dipendra Khadka <kdipendra88@...il.com>,
	linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c

Smatch reported dereferencing freed memory 'fw' in tps6598x_apply_patch().

Invoking relrease_firmware(fw) just after checking ret.

Fixes: 916b8e5fa73d ("usb: typec: tipd: add error log to provide firmware name and size")
Signed-off-by: Dipendra Khadka <kdipendra88@...il.com>
---
v2:
 - Updated patch subject.
 - Updated patch description.
 - Added Fixes tag.
v1: 
 drivers/usb/typec/tipd/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index ea768b19a7f1..70bf8023ea35 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -1191,12 +1191,13 @@ static int tps6598x_apply_patch(struct tps6598x *tps)
 	dev_info(tps->dev, "Firmware update succeeded\n");
 
 release_fw:
-	release_firmware(fw);
 	if (ret) {
 		dev_err(tps->dev, "Failed to write patch %s of %zu bytes\n",
 			firmware_name, fw->size);
 	}
 
+	relrease_firmware(fw);
+
 	return ret;
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ