From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFF3D3E6DF0 for ; Tue, 17 Mar 2026 14:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773758205; cv=none; b=TvjWH8AAIfzvbUsvBuRFrZN8F52O0f8y/PmJekGPvwaha4w4TAhJ3tiR5kT9V3OCUA7B/mYNE7QgMYXg23tZn/63HFrh8zwZs+a90U1pFAVPBsfWHdb8ZgUWsOiYNQsTa6uF10F64Fgwui5RPPMgKtpdHrIAunqvgBIX/THKSGM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773758205; c=relaxed/simple; bh=n1p/gBAuYmJ/Y3L2fdiAn01PtrCjpFl4xRVnrRjXrqk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AnIVa/mAf9gjxfRUbV6KbxaspqB3uRpMsH8tn3Pe3W5bEPSiNzvymVpZmKKrKnKRhkumZAbM8ind1dMo78eZUGbGDd+knp+lfsIzN5YoKUCw4DUY0Tfp0UXjvZxgobvcvD+9D4ArxKBhqd4PJCglUeeAl0ufmeRG5s0NkcHgSN0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=VOFCi6qh; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="VOFCi6qh" Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 64FEE20B710C; Tue, 17 Mar 2026 07:36:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 64FEE20B710C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1773758203; bh=GuzkCcjMYrRq1Rq+jtymL5RlvyprBCmsF6sGetQftIQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VOFCi6qhQDM8R4aYHupZPjYIiAyHeVUPUHRw5FBXH+nPtg8KUnN+Ul3D/CheyyRZi YZJWXAMa6vNDc7tJRP9+/9QjA+ccxmNNh+fgRY0Fft89SyM1PUBJlcFCRRooO45LwA RWoJuEeWk3ASOLnsO0HRkYO2KOEYcmKZZYsNNkI8= From: Prasanna Kumar T S M 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 Message-ID: <20260317143643.1329013-1-ptsm@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260317133517.1324319-1-ptsm@linux.microsoft.com> References: <20260317133517.1324319-1-ptsm@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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