[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4800085e-1a75-4d14-9f0f-f4161c4af505@wolfvision.net>
Date: Thu, 25 Jul 2024 07:40:14 +0200
From: Javier Carrasco <javier.carrasco@...fvision.net>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Abdel Alkuor <abdelalkuor@...tab.com>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: dan.carpenter@...aro.org, kernel-janitors@...r.kernel.org,
error27@...il.com
Subject: Re: [PATCH 1/2] usb: typec: tipd: Fix dereferencing freeing memory in
tps6598x_apply_patch()
On 24/07/2024 18:23, Harshit Mogalapalli wrote:
> 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@...cle.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;
> };
Hi Harshit, thanks for the fix.
Reviewed-by: Javier Carrasco <javier.carrasco@...fvision.net>
Powered by blists - more mailing lists