From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: ptsm.linux.microsoft.com, 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: [PATCH 2/2] soc: xilinx: Shutdown and free rx mailbox channel
Date: Tue, 17 Mar 2026 07:36:43 -0700 [thread overview]
Message-ID: <20260317143643.1329013-1-ptsm@linux.microsoft.com> (raw)
In-Reply-To: <20260317133517.1324319-1-ptsm@linux.microsoft.com>
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);
}
--
2.49.0
next prev parent reply other threads:[~2026-03-17 14:36 UTC|newest]
Thread overview: 4+ 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
2026-03-17 14:36 ` Prasanna Kumar T S M [this message]
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
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=20260317143643.1329013-1-ptsm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.