From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: Michal Simek <michal.simek@amd.com>,
jay.buddhabhatti@amd.com, marco.crivellari@suse.com,
tejas.patel@xilinx.com, rajan.vaja@xilinx.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] soc: xilinx: Shutdown and free rx mailbox channel
Date: Fri, 20 Mar 2026 11:36:31 +0530 [thread overview]
Message-ID: <ea83916c-36cd-4d73-af14-a80565984064@linux.microsoft.com> (raw)
In-Reply-To: <fa75334e-6cce-4a6e-8072-132b8823deb9@amd.com>
On 18-03-2026 21:36, Michal Simek wrote:
>
>
> On 3/17/26 15:36, Prasanna Kumar T S M wrote:
>> [Some people who received this message don't often get email from
>> ptsm@linux.microsoft.com. Learn why this is important at https://
>> aka.ms/LearnAboutSenderIdentification ]
>>
>> A mbox rx channel is requested using mbox_request_channel_byname() in
>> probe. In remove callback, the rx mailbox channel is cleaned up when the
>> rx_chan is NULL due to incorrect condition check. The mailbox channel is
>> not shutdown and it can receive messages even after the device removal.
>> This leads to use after free. Also the channel resources are not freed.
>> Fix this by checking the rx_chan correctly.
>>
>> Fixes: ffdbae28d9d1 ("drivers: soc: xilinx: Use mailbox IPI callback")
>> Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
>> ---
>> drivers/soc/xilinx/zynqmp_power.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/
>> zynqmp_power.c
>> index aa35b63b45a3..5086c1e6797e 100644
>> --- a/drivers/soc/xilinx/zynqmp_power.c
>> +++ b/drivers/soc/xilinx/zynqmp_power.c
>> @@ -398,7 +398,7 @@ static void zynqmp_pm_remove(struct
>> platform_device *pdev)
>> {
>> sysfs_remove_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr);
>>
>> - if (!rx_chan)
>> + if (rx_chan)
>> mbox_free_channel(rx_chan);
>
>
> Please also clear that global variable because when the driver is re-
> bound there will be old reference to rx_chan which shouldn't be there.
>
> if (rx_chan) {
> mbox_free_channel(rx_chan);
> rx_chan = NULL;
> }
>
> And please send both patches as one thread.
>
> Thanks,
> Michal
Hi Michal,
Thanks for the review. Sent v2.
Thanks,
Prasanna
prev parent reply other threads:[~2026-03-20 6:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 13:35 [PATCH 1/2] soc: xilinx: Fix race condition in event registration Prasanna Kumar T S M
[not found] ` <20260317143643.1329013-1-ptsm@linux.microsoft.com>
2026-03-18 16:06 ` [PATCH 2/2] soc: xilinx: Shutdown and free rx mailbox channel Michal Simek
2026-03-20 6:06 ` Prasanna Kumar T S M [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=ea83916c-36cd-4d73-af14-a80565984064@linux.microsoft.com \
--to=ptsm@linux.microsoft.com \
--cc=jay.buddhabhatti@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.crivellari@suse.com \
--cc=michal.simek@amd.com \
--cc=rajan.vaja@xilinx.com \
--cc=tejas.patel@xilinx.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