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 3D6341AA1D2 for ; Fri, 20 Mar 2026 06:04:46 +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=1773986687; cv=none; b=t/Ginm284LW+Us/+ojd6cttTWoiuEHyhX1qiOumbDQoquhA1qwqP4vQlQhNDj0ZpeRwDGDwhgV+U9pz6usDYoUq5vfTf8TXogxAp9fC7A9arIAlXVExiaRp9y4Y1qPBdR6Bz2Quclw6qIudvrkF0TrT+6c6Rd/SmEsQgdMBMcW4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773986687; c=relaxed/simple; bh=KlZJ8BNaR3nX0PwlViC8KgMlUBE9PrzLUGlqE4iIFN8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C08uAg27eBO8NiEnCrdJWuRPZA2DWGzxOJEiYeU2UQhLV/j+KHE61P0mXAJ6eZtswkrReOJOPuA4iC8xB6zwFVaG7kXp6PdFszbmnUVyLr/d7o7uIj4psnf/T2tIuMH6v3p10PXM0PIbaZhDysaUN175rG5Jhk4KAX/xqiLsgbQ= 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=nMvAdZMx; 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="nMvAdZMx" Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id EF2D620B710C; Thu, 19 Mar 2026 23:04:45 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EF2D620B710C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1773986686; bh=VXInfPSwAGRRtB+ybyzTEt3gvSIjjBC1jeS0/7UiiIY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nMvAdZMxtQl+dV2uHFrQSvxOd+oIf5Ub6RKPhxigQaMLVUaA+2ku3AGTFCSn71c8l heKqlvvO+IS4cY3dGVNhZtf0vHQw0NYZ/SJeujdGlgOWeQ2Dxu6G6/nr5ms9LgJTzY kPbTV6NDUwT78PruzFOCuPK58PHa0e4KOZ3DvcuI= From: Prasanna Kumar T S M To: ptsm@linux.microsoft.com, michal.simek@amd.com, jay.buddhabhatti@amd.com, marco.crivellari@suse.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] soc: xilinx: Shutdown and free rx mailbox channel Date: Thu, 19 Mar 2026 23:04:45 -0700 Message-ID: <20260320060445.1541017-1-ptsm@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260320060306.1540928-1-ptsm@linux.microsoft.com> References: <20260320060306.1540928-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: ffdbae28d9d1a ("drivers: soc: xilinx: Use mailbox IPI callback") Signed-off-by: Prasanna Kumar T S M --- drivers/soc/xilinx/zynqmp_power.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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[] = { -- 2.49.0