mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: typec: tipd: Fix dereferencing freeing memory in tps6598x_apply_patch()
@ 2024-07-24 16:23 Harshit Mogalapalli
  2024-07-24 16:23 ` [PATCH 2/2] usb: typec: tipd: Delete extra semi-colon Harshit Mogalapalli
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Harshit Mogalapalli @ 2024-07-24 16:23 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Javier Carrasco,
	Abdel Alkuor, Harshit Mogalapalli, linux-usb, linux-kernel
  Cc: dan.carpenter, kernel-janitors, error27

release_firmware() already frees fw, fix this my moving release_firmware
after the dereference.

Fixes: 916b8e5fa73d ("usb: typec: tipd: add error log to provide firmware name and size")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is found with smatch, only compile tested
---
 drivers/usb/typec/tipd/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
index ea768b19a7f1..eb5596e3406a 100644
--- a/drivers/usb/typec/tipd/core.c
+++ b/drivers/usb/typec/tipd/core.c
@@ -1191,11 +1191,11 @@ 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);
 	}
+	release_firmware(fw);
 
 	return ret;
 };
-- 
2.45.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-30  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-24 16:23 [PATCH 1/2] usb: typec: tipd: Fix dereferencing freeing memory in tps6598x_apply_patch() Harshit Mogalapalli
2024-07-24 16:23 ` [PATCH 2/2] usb: typec: tipd: Delete extra semi-colon Harshit Mogalapalli
2024-07-25  5:45   ` Javier Carrasco
2024-07-30  8:45   ` Heikki Krogerus
2024-07-25  5:40 ` [PATCH 1/2] usb: typec: tipd: Fix dereferencing freeing memory in tps6598x_apply_patch() Javier Carrasco
2024-07-30  8:44 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®