From: sashiko-bot@kernel.org
To: "Xu Yang" <xu.yang_2@oss.nxp.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: cdns3: imx: fix kernel panic on remove due to kfree of static platform_data
Date: Mon, 19 Oct 2026 08:50:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-176848@kernel.org> (raw)
In-Reply-To: <20261019084944.2051097-1-xu.yang_2@oss.nxp.com>
> From: Xu Yang <xu.yang_2@nxp.com>
>
> When cdns_imx_remove() calls of_platform_depopulate(), the child
> platform device is destroyed. platform_device_release() then calls
> kfree(pdev->dev.platform_data), but cdns3-imx assigns a pointer to
> a static global variable as platform_data, so kfree() on it triggers
> a kernel panic.
>
> [ 56.809541] Call trace:
> [ 56.811982] kfree+0x44/0x398 (P)
> [ 56.815300] platform_device_release+0x24/0x4c
> [ 56.819747] device_release+0x3c/0xa0
> [ 56.823413] kobject_put+0xa0/0x120
> [ 56.826906] klist_children_put+0x18/0x28
> [ 56.830920] klist_prev+0xb4/0x1c0
> [ 56.834325] device_for_each_child_reverse+0x7c/0xc8
> [ 56.839294] of_platform_depopulate+0x34/0x80
> [ 56.843664] cdns_imx_remove+0x34/0xcc [cdns3_imx]
>
> Fix this by iterating over child devices and clearing platform_data
> to NULL before of_platform_depopulate() is called, preventing the
> invalid kfree().
>
> Fixes: ff6d6e6c6778 ("usb: cdns3: imx: add glue layer runtime pm implementation")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019084944.2051097-1-xu.yang_2@oss.nxp.com?part=1
next prev parent reply other threads:[~2026-10-19 8:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 8:49 [PATCH] usb: cdns3: imx: fix kernel panic on remove due to kfree of static platform_data Xu Yang
2026-10-19 8:50 ` sashiko-bot [this message]
2026-10-19 20:38 ` Frank Li
2026-10-20 2:02 ` Peter Chen (Qualcomm)
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=sashiko-outbox-176848@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xu.yang_2@oss.nxp.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