summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorPrasanna Kumar T S M <ptsm@linux.microsoft.com>2026-03-19 23:04:45 -0700
committerMichal Simek <michal.simek@amd.com>2026-04-30 12:50:05 +0200
commitfdee7c66c0d7b6869c36b9f9a915abf29ab5b550 (patch)
tree4a5b7408d9446d8ffdf875b249b5e30f9f1d2e34 /drivers/soc
parentfb445935338405110baca8f541a2df3b4cb8d712 (diff)
soc: xilinx: Shutdown and free rx mailbox channel
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: ffdbae28d9d1a ("drivers: soc: xilinx: Use mailbox IPI callback") Signed-off-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/20260320060445.1541017-1-ptsm@linux.microsoft.com
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/xilinx/zynqmp_power.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c
index 9dd938bd01d8..370e61ac47d8 100644
--- a/drivers/soc/xilinx/zynqmp_power.c
+++ b/drivers/soc/xilinx/zynqmp_power.c
@@ -389,8 +389,10 @@ 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);
+ rx_chan = NULL;
+ }
}
static const struct of_device_id pm_of_match[] = {