From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Javier Carrasco <javier.carrasco@wolfvision.net>,
Abdel Alkuor <abdelalkuor@geotab.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org,
error27@gmail.com
Subject: Re: [PATCH 1/2] usb: typec: tipd: Fix dereferencing freeing memory in tps6598x_apply_patch()
Date: Tue, 30 Jul 2024 11:44:44 +0300 [thread overview]
Message-ID: <Zqin/MvcyKLd3RAr@kuha.fi.intel.com> (raw)
In-Reply-To: <20240724162356.992763-1-harshit.m.mogalapalli@oracle.com>
On Wed, Jul 24, 2024 at 09:23:50AM -0700, 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@oracle.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.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
--
heikki
prev parent reply other threads:[~2024-07-30 8:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 16:23 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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zqin/MvcyKLd3RAr@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=abdelalkuor@geotab.com \
--cc=dan.carpenter@linaro.org \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=harshit.m.mogalapalli@oracle.com \
--cc=javier.carrasco@wolfvision.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®