From: Marek Vasut <marek.vasut@mailbox.org>
To: Siddharth Vadapalli <s-vadapalli@ti.com>
Cc: Nishanth Menon <nm@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: Thu, 28 Aug 2025 17:46:56 +0200 [thread overview]
Message-ID: <9833dfa9-562a-4f2d-ae65-d00bc4de2c92@mailbox.org> (raw)
In-Reply-To: <6e5ccaaa-3ced-440a-abe7-439ef6e7f1db@ti.com>
On 8/24/25 10:02 AM, Siddharth Vadapalli wrote:
> On Sat, Aug 23, 2025 at 02:21:18PM +0200, Marek Vasut wrote:
>> On 8/23/25 4:07 AM, Siddharth Vadapalli wrote:
>>
>> Hi,
>>
>>>>>>> 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.
>>>> Do you know which SoC is V2 and V3 ?
>>>
>>> I spent more time on this and found out that J721E SR 1.0 has the
>>> controller with DEV_VER_TI_V1 version but other revisions of J721E as
>>> well as all of the following SoCs have DEV_VER_V3 version of the
>>> controller:
>>> AM64, AM68, AM69, J7200, J721S2, J722S, J742S2 and J784S4.
>>>
>>> I will try to find an SR 1.0 J721E SoC and test the patch on it and
>>> share the results here.
>> This is awesome, thank you !
>
> I was able to get an SR 1.0 J721E SoC and also the J721E
> Common-Processor-Board for testing the patch.
>
> Enabling debug info in the cdns3/gadget.c driver, I see:
> cdns-usb3-peripheral usb@6000000: Device Controller version: 00024509
> cdns-usb3-peripheral usb@6000000: USB Capabilities:: 09203324
> cdns-usb3-peripheral usb@6000000: On-Chip memory cnfiguration: 00000c34
> which confirms the Controller Version.
>
> However, the code changed by the current patch is only affecting the
> execution of code associated with Workaround 2 which is described in
> detail in the driver. I am summarizing it here for your reference:
>
> Issue:
> Controller for OUT endpoints has shared on-chip buffers for all
> incoming packets. The buffer acts as a FIFO, due to which,
> missing a DMA descriptor for one packet will block subsequent
> transfers/packets meant for other Endpoints that were queued.
>
> Workaround:
> If the Endpoint Status register indicates a Descriptor Miss,
> rearm the DMA transfer to complete the missed transfer.
>
> In order to test the patch, I used USBACM for STDIO/STDOUT to check if I
> could trigger the descriptor miss workaround. The command I ran was:
> setenv stdio usbacm; setenv stdout usbacm;
> /dev/ttyACM0 showed up on my PC and I was also able to access the U-Boot
> prompt via ACM0. While it is functional, I didn't see the code
> associated with the workaround being triggered. Reviewing the driver
> again, I identified that the workaround is being disabled very early on
> within "cdns3_wa2_gadget_ep_queue()" with the comment stating:
>
> * If transfer was queued before DESCMISS appear than we
> * can disable handling of DESCMISS interrupt. Driver assumes that it
> * can disable special treatment for this endpoint.
>
> Given the above, it doesn't seem easy to recreate the issue since I
> would have to trigger a descriptor miss event prior to the very first
> USB transfer for the Endpoint. Please let me know if you have any
> suggestions for speeding up testing.
Can you maybe simply force-enable the workaround code and see if that
itself works, without crashing ? If yes, then I would say let's apply this.
next prev parent reply other threads:[~2025-08-28 15:47 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
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 [this message]
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=9833dfa9-562a-4f2d-ae65-d00bc4de2c92@mailbox.org \
--to=marek.vasut@mailbox.org \
--cc=andrew.goodbody@linaro.org \
--cc=mkorpershoek@kernel.org \
--cc=nm@ti.com \
--cc=s-vadapalli@ti.com \
--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