From nobody Sat Jun 13 23:45:00 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3D021E9906; Sat, 13 Jun 2026 19:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781377654; cv=none; b=Tan6E1m9yaKfLv6jTzf0XBeKOAe3hbTVDTEnwiinEBa2f6p5HEcZYplnDTfJOrjLg8Q2PEWzonAHmlwRArby4dNkdQkUiVV6o2bqxZe/oe+yIPGkeor0PdUY1ds/rTQBW3wo9LphW31k6mIpYJktODB19TW/vBc75mr0MatB4qM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781377654; c=relaxed/simple; bh=lHyvMhVwENJFALc/5ixBOCg3MmXrmFBEpyugbfQOs3g=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=cYeRZfjnk2tVRVaEhH+CPojrKu6eR2z6FQo5aOP9OxV6sXEA9/yekMoPcv/AXzOx6QSUfBaa95b3cOHcl73Np/TUYxNzlFaIfH13+KvXvL7fx0DP9admogDnXxNzC+hNY3ZxXhUTgyWuYiJrkRlzmfHcwiq9MmsOiz5HJVQAY7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=VAAtrTU9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jTV7Q+/6; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VAAtrTU9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jTV7Q+/6" Date: Sat, 13 Jun 2026 19:07:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1781377650; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xT37V/RnK9JeR9n0INNEp8LshiXo/as3ebSRA/zUyUs=; b=VAAtrTU9MWjRPZ5xuV3IdxcQ0soerX6yr/QdRD2Ovd3n4Hg2BhMneLAac5lMaNO1u4w1as ZYfyWtNmaDbtUPKzSGR8jXBXcjBwprSsPLDa7WxTZAZgPJqLuPgtvvRODKdKFp6lSdhaU3 yx22xtS5LyomoN6G/lAc5Ftwq8n47vmDP4dKTdUgq3o2xjl1iR14SZdAjfsz1ciB9OeJJB QQ9S3Mp/tewRBaOQSr04S0MRugDWICozXukc4z60mIDe/Ovg1z72WbSkKmLlFKtquytvjj 7gpgrWHdWG5DGVZr5eqy/dykGZ38UmVzpItcyt31UJERwZMSnIC5UqPo3nYDLg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1781377650; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xT37V/RnK9JeR9n0INNEp8LshiXo/as3ebSRA/zUyUs=; b=jTV7Q+/61dRw6a/veAPimAB7y27mk+pJbbN5gX7hkP6SC188vKp9+ZUbAqMS+DRhg44s6Z XiH/l0ljC0cATaCg== From: "tip-bot2 for Yuanhe Shu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/msi] Revert "PCI/MSI: Unmap MSI-X region on error" Cc: Guenter Roeck , Yuanhe Shu , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260611025901.1105209-1-xiangzao@linux.alibaba.com> References: <20260611025901.1105209-1-xiangzao@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178137764918.1650852.10128947724378277644.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the irq/msi branch of tip: Commit-ID: f64e03da0d83cb173743888bff4a7e61476a8fc2 Gitweb: https://git.kernel.org/tip/f64e03da0d83cb173743888bff4a7e614= 76a8fc2 Author: Yuanhe Shu AuthorDate: Thu, 11 Jun 2026 10:59:01 +08:00 Committer: Thomas Gleixner CommitterDate: Sat, 13 Jun 2026 21:03:02 +02:00 Revert "PCI/MSI: Unmap MSI-X region on error" This reverts commit 1a8d4c6ecb4c81261bcdf13556abd4a958eca202. Commit 1a8d4c6ecb4c ("PCI/MSI: Unmap MSI-X region on error") added an iounmap(dev->msix_base) on the error path of msix_capability_init() to release the MSI-X region when msix_setup_interrupts() fails. When msix_setup_interrupts() fails, the call chain is: msix_setup_interrupts() -> __msix_setup_interrupts() struct pci_dev *dev __free(free_msi_irqs) =3D __dev; ... return ret; // __free cleanup fires on error The __free(free_msi_irqs) cleanup calls pci_free_msi_irqs(), which already handles the unmap: void pci_free_msi_irqs(struct pci_dev *dev) { pci_msi_teardown_msi_irqs(dev); if (dev->msix_base) { iounmap(dev->msix_base); // already unmapped here dev->msix_base =3D NULL; // and set to NULL } } So dev->msix_base is unmapped and set to NULL before msix_setup_interrupts() returns to msix_capability_init(). The "goto out_unmap" introduced by commit 1a8d4c6ecb4c ("PCI/MSI: Unmap MSI-X region on error") then calls iounmap() a second time on a NULL pointer. This was reproduced on Intel Emerald Rapids (192 CPUs) while running tools/testing/selftests/kexec/test_kexec_jump.sh: WARNING: CPU#44 at iounmap+0x2a/0xe0 RIP: 0010:iounmap+0x2a/0xe0 RDI: 0000000000000000 Call Trace: msix_capability_init+0x317/0x3f0 __pci_enable_msix_range+0x21d/0x2c0 pci_alloc_irq_vectors_affinity+0xa9/0x130 nvme_setup_io_queues+0x2a8/0x420 [nvme] nvme_reset_work+0x151/0x340 [nvme] ... RDI=3D0 confirms iounmap() is called with NULL. Restore the original "goto out_disable" and leave the unmap to the existing __free(free_msi_irqs) cleanup. Fixes: 1a8d4c6ecb4c ("PCI/MSI: Unmap MSI-X region on error") Reported-by: Guenter Roeck Signed-off-by: Yuanhe Shu Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/all/20260610194406.GA380991@bhelgaas/ Link: https://patch.msgid.link/20260611025901.1105209-1-xiangzao@linux.alib= aba.com Closes: https://lore.kernel.org/all/4fc6208d-513b-4f41-a13a-4a0829ab50ad@ro= eck-us.net/ --- drivers/pci/msi/msi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index 81d24a2..a3e0daf 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -749,7 +749,7 @@ static int msix_capability_init(struct pci_dev *dev, st= ruct msix_entry *entries, =20 ret =3D msix_setup_interrupts(dev, entries, nvec, affd); if (ret) - goto out_unmap; + goto out_disable; =20 /* Disable INTX */ pci_intx_for_msi(dev, 0); @@ -770,8 +770,6 @@ static int msix_capability_init(struct pci_dev *dev, st= ruct msix_entry *entries, pcibios_free_irq(dev); return 0; =20 -out_unmap: - iounmap(dev->msix_base); out_disable: dev->msix_enabled =3D 0; pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_= ENABLE, 0);