From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796360696; b=c4LyXjtViML3k594bJofgDqOFbh9cM6a8rJ3H24eFnCKAHHz26OGV+PdYwE4c5LgNLVZ XkZJWdAa2i4P7rqzh8JhokGv3rQMcZFPF6ZMptNo+RMfZXa1RGRQsU325XpCbH2oj0h2N fDOqsOSt/SfqH+QmLuvi8vFLbYzxOSXt/D4jVvWYqpoZxyHbvhtdgDbO4Alkc0rnzaDaI /aD0cZ+4FjpNHhRsk/IKhx1g4WC3K+VNJv7DZAxckOsKuUcZX1MbTZzN8h88T1Zwwg9Jn 13yQH287JTFczJ0K0d7XX23cvhWFBi7HHny/7cQ8e2j6Sun7jdYMG/qS1uv3yk3HXBw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796360696; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:From:To:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Spam-Status:X-Spam-Checker-Version; bh=9WAKaPgV3HstjC1wejBfvu9av6CFNEFlO5U7+itqUy8=; b=41DjE+ySV4MEU4AXssK25DLC8z2kTacYFDgsSGcIY++E7FPoMFNF9CBMC43bpMzXifsS VAJTsu0hgidcyhwQDdguNip8IF0x5OwT3wEEx11d+UNrUEXCJwoZKS6nltVBrRwVa9gGN 2m8EahBUwmTgonQBDH8KtvjRdMWFN09CZgwFU+5MDsWx0DJl8C46Kubp/GUWnMaJCWUxB +sl2elqDE4POcHFvrm4LFs1QW4chUTyYxx9QrEc1GYbwZuABFMFnNTi+yzSG0vYFzLgYe lORWtvPXRM4Gw7d4P9jHCUg/Vkj7JYGQu6tTJsx/YYKO+3iMbJCC1wVxunJnB7afTyg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=ZdREAGdZ; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C76F606A685 for ; Fri, 4 Dec 2026 05:04:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9C76F606A685 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.a=rsa-sha256 header.s=default header.b=ZdREAGdZ Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id D372A20B716A; Thu, 3 Dec 2026 21:04:54 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D372A20B716A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796360694; bh=9WAKaPgV3HstjC1wejBfvu9av6CFNEFlO5U7+itqUy8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZdREAGdZH09p/oAv4igI/PdvKwiyHHLRZMU1WL2IErrOIDytyadP8iB0HzKwGWnsJ qRJLChkIdtvQSX42+xaqFhNOjShmSzBJ+brr1NfWCjYnY0IiNpWepEdcQdg/fwAutK OVl7Fy1SB40w7p2Lt87hZm2uFg5joNMahQb7yBls= From: Prasanna Kumar T S M To: ptsm@linux.microsoft.com, jassisinghbrar@gmail.com, michal.simek@amd.com, tanmay.shah@amd.com, saeed.nowshadi@amd.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ssengar@linux.microsoft.com, tgopinath@linux.microsoft.com, srivatsa@csail.mit.edu, jay.buddhabhatti@amd.com, gregkh@linuxfoundation.org, radheys@amd.com Subject: [PATCH v3 2/5] mailbox: zynqmp-ipi: Fix SGI cleanup on request_percpu_irq() failure Date: Thu, 3 Dec 2026 21:04:50 -0800 Message-ID: <20261204050453.18005-3-ptsm@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20261204050453.18005-1-ptsm@linux.microsoft.com> References: <20261204050453.18005-1-ptsm@linux.microsoft.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When xlnx_mbox_init_sgi() fails before or during request_percpu_irq(), zynqmp_ipi_probe() still invokes xlnx_mbox_cleanup_sgi() through zynqmp_ipi_free_mboxes(). This causes cleanup to run on an unmapped virq_sgi or dispose the IRQ mapping a second time. Clear virq_sgi after disposing the mapping on request_percpu_irq() failure and teardown IRQ in xlnx_mbox_cleanup_sgi() only when virq_sgi is valid. Fixes: 6ffb1635341b ("mailbox: zynqmp: handle SGI for shared IPI") Cc: stable@vger.kernel.org Signed-off-by: Prasanna Kumar T S M --- drivers/mailbox/zynqmp-ipi-mailbox.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 179f361d04b3..b978f4e9f830 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -859,6 +859,7 @@ static int xlnx_mbox_init_sgi(struct platform_device *pdev, WARN_ON(ret); if (ret) { irq_dispose_mapping(pdata->virq_sgi); + pdata->virq_sgi = 0; return ret; } @@ -880,11 +881,13 @@ static void xlnx_mbox_cleanup_sgi(struct zynqmp_ipi_pdata *pdata) if (pdata->hp_state >= CPUHP_AP_ONLINE_DYN) cpuhp_remove_state(pdata->hp_state); - on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); + if (pdata->virq_sgi) { + on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); - irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); - free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); - irq_dispose_mapping(pdata->virq_sgi); + irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU); + free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata); + irq_dispose_mapping(pdata->virq_sgi); + } } /** -- 2.49.0