From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: Marek Vasut <marek.vasut@mailbox.org>
Cc: Siddharth Vadapalli <s-vadapalli@ti.com>,
Andrew Goodbody <andrew.goodbody@linaro.org>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Tom Rini <trini@konsulko.com>,
"vigneshr@ti.com" <vigneshr@ti.com>, <u-boot@lists.denx.de>
Subject: Re: [PATCH] usb: cdns3: Do not access memory after free
Date: Fri, 22 Aug 2025 19:44:06 +0530 [thread overview]
Message-ID: <63d6759a-a8be-41d6-8870-72bdc3856c05@ti.com> (raw)
In-Reply-To: <2ff9412a-795c-422b-9be4-576e64a7f395@mailbox.org>
On Thu, Aug 21, 2025 at 10:22:43PM +0200, Marek Vasut wrote:
> On 8/21/25 8:16 AM, Siddharth Vadapalli wrote:
>
> Hi,
>
> > > > > > diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> > > > > > index a30c40ef80e..9eaf7e40ab6 100644
> > > > > > --- a/drivers/usb/cdns3/gadget.c
> > > > > > +++ b/drivers/usb/cdns3/gadget.c
> > > > > > @@ -557,10 +557,10 @@ static void
> > > > > > cdns3_wa2_remove_old_request(struct cdns3_endpoint *priv_ep)
> > > > > > trace_cdns3_wa2(priv_ep, "removes eldest request");
> > > > > > + list_del_init(&priv_req->list);
> > > > > > kfree(priv_req->request.buf);
> > > > > > cdns3_gadget_ep_free_request(&priv_ep->endpoint,
> > > > > > &priv_req->request);
> > > > > > - list_del_init(&priv_req->list);
> > > > >
> > > > > Shouldn't the kfree() be moved here instead ?
> > > > > cdns3_gadget_ep_free_request() also accesses priv_req->request .
> > > >
> > > > No, I do not think so. The kfree frees priv_req->request.buf not
> > > > priv_req->request so must happen before the call to
> > > > cdns3_gadget_ep_free_request.
> > > Thank you for clarifying. Please add this into the commit message, ideally
> > > wait for TI to test this and provide RB, then send V2 so this can go in.
> >
> > I was planning to test this patch but the change being made is only
> > applicable to Controller Versions:
> > #define DEV_VER_NXP_V1 0x00024502
> > #define DEV_VER_TI_V1 0x00024509
> > and not to:
> > #define DEV_VER_V2 0x0002450C
> > #define DEV_VER_V3 0x0002450d
> >
> > Since I don't have an SoC and a Board with DEV_VER_TI_V1, I cannot test
> > it. However, the change looks correct to me.
> >
> > Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> The change does indeed look correct.
>
> Do you know who might still have that board and could test ? (and which
> board/soc is that) ?
None of the boards that I have worked with have a DEV_VER_TI_V1 version
of the controller. I also tried to use the Linux device-tree to check if
I could identify the SoC/board but I was unable to do so.
Regards,
Siddharth.
next prev parent reply other threads:[~2025-08-22 14:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 16:30 [PATCH] usb: cdns3: Do not access memory after free Andrew Goodbody
2025-08-14 3:21 ` Marek Vasut
2025-08-14 10:45 ` Andrew Goodbody
2025-08-19 14:51 ` Marek Vasut
2025-08-21 6:16 ` Siddharth Vadapalli
2025-08-21 20:22 ` Marek Vasut
2025-08-22 14:14 ` Siddharth Vadapalli [this message]
2025-08-22 14:55 ` Marek Vasut
2025-08-23 2:07 ` Siddharth Vadapalli
2025-08-23 12:21 ` Marek Vasut
2025-08-24 8:02 ` Siddharth Vadapalli
2025-08-28 15:46 ` Marek Vasut
2025-08-29 4:22 ` Siddharth Vadapalli
2025-08-29 8:49 ` Marek Vasut
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=63d6759a-a8be-41d6-8870-72bdc3856c05@ti.com \
--to=s-vadapalli@ti.com \
--cc=andrew.goodbody@linaro.org \
--cc=marek.vasut@mailbox.org \
--cc=mkorpershoek@kernel.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vigneshr@ti.com \
/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