* [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c
@ 2024-09-23 9:26 Dipendra Khadka
2024-09-23 9:47 ` Greg KH
2024-10-04 8:12 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Dipendra Khadka @ 2024-09-23 9:26 UTC (permalink / raw)
To: heikki.krogerus, gregkh; +Cc: Dipendra Khadka, linux-usb, linux-kernel
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@gmail.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c
2024-09-23 9:26 [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c Dipendra Khadka
@ 2024-09-23 9:47 ` Greg KH
2024-10-04 8:12 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-09-23 9:47 UTC (permalink / raw)
To: Dipendra Khadka; +Cc: heikki.krogerus, linux-usb, linux-kernel
On Mon, Sep 23, 2024 at 09:26:24AM +0000, Dipendra Khadka wrote:
> 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@gmail.com>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c
2024-09-23 9:26 [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c Dipendra Khadka
2024-09-23 9:47 ` Greg KH
@ 2024-10-04 8:12 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-10-04 8:12 UTC (permalink / raw)
To: Dipendra Khadka; +Cc: heikki.krogerus, linux-usb, linux-kernel
On Mon, Sep 23, 2024 at 09:26:24AM +0000, Dipendra Khadka wrote:
> 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@gmail.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);
Any specific reason why you did not even compile this version of the
patch?
{sigh}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-04 8:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 9:26 [PATCH v2] usb: typec: tipd: Fix dereferencing freed memory 'fw in core.c Dipendra Khadka
2024-09-23 9:47 ` Greg KH
2024-10-04 8:12 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox