Skip to content

Commit

Permalink
usb: typec: tipd: Fix dereferencing freeing memory in tps6598x_apply_…
Browse files Browse the repository at this point in the history
…patch()

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

Fixes: 916b8e5 ("usb: typec: tipd: add error log to provide firmware name and size")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Javier Carrasco <javier.carrasco@wolfvision.net>
Link: https://lore.kernel.org/r/20240724162356.992763-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Harshit Mogalapalli authored and Greg Kroah-Hartman committed Jul 31, 2024
1 parent 5a444be commit 8290b56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/typec/tipd/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 8290b56

Please sign in to comment.