[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240922105212.28099-1-kdipendra88@gmail.com>
Date: Sun, 22 Sep 2024 10:52:11 +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] Fix dereferencing freed memory 'fw'
smatch reported dereferencing freed memory as below:
'''
drivers/usb/typec/tipd/core.c:1196 tps6598x_apply_patch() error: dereferencing freed memory 'fw'
'''
Invoking release_firware(fw) just after checking ret.
Signed-off-by: Dipendra Khadka <kdipendra88@...il.com>
---
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.43.0
Powered by blists - more mailing lists