From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1033F35C1A6; Tue, 21 Jul 2026 19:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663098; cv=none; b=TvAIu/V7IQy00CfpQU/TAX0069/WeU3fVtKBgXUCsdt2VPAtnttbY47O14DXEckxS+L4t1s1HW7GyFSNa3mBTzEMtQVjxud5xFsFwb5ZivkAidaQ+HCvd1HmQ1shgUoifK6dePNYgFf0P0DSIPz1xnzIXx/OvBuRxzgfItXATco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663098; c=relaxed/simple; bh=3+7JGmE1N9U+GB2cRAwKKaRQHw2ePnt7MCLNlvCXHuQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=of1/moYWd0QChmbsnkUTjBRkFF+kDkjTu9A70YW/o0IU7soF2EzBcCKLFr1wyOb0kXRqbV96Nhh/kHHU5yAyCGSoMgyjsUwq3+K0CA4dITYxibuFNlLXXjZZ7lSE+cUhcs/8Zzi8C7ArLk9cfT6r3ZZeZWNmS7HXMK9aPpEJAhk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2ol9rmWi; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2ol9rmWi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BAFD1F000E9; Tue, 21 Jul 2026 19:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784663097; bh=K9fGmNVvZ4RYkB7T4qLn3GZU2u3FKjTKJDjO6jQOIw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2ol9rmWiknlm7lKkTbDMMzXmV9g2YpQrmgSaA0FzAUH5s4LN9V6FczMF2wTxpHt2e da1kgrr6EvM39gaZlariLPnkgyLUh2QYWn45DDcRqpwFfcJwxsUJuiFf+cvKtKKS8Z 3Ue5btzlW1Vud/VOrXlG9FijFr394OaCC9mqcfNI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Bjorn Helgaas , Magnus Lindholm , Shivaprasad G Bhat , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.12 0651/1276] alpha/PCI: Add security_locked_down() check to pci_mmap_resource() Date: Tue, 21 Jul 2026 17:18:14 +0200 Message-ID: <20260721152500.679425160@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Krzysztof Wilczyński [ Upstream commit 78a228f0aa0e9eba31955950c8a40a9945e2c8bb ] Currently, Alpha's pci_mmap_resource() does not check security_locked_down(LOCKDOWN_PCI_ACCESS) before allowing userspace to mmap PCI BARs. The generic version has had this check since commit eb627e17727e ("PCI: Lock down BAR access when the kernel is locked down") to prevent DMA attacks when the kernel is locked down. Add the same check to Alpha's pci_mmap_resource(). Fixes: eb627e17727e ("PCI: Lock down BAR access when the kernel is locked down") Signed-off-by: Krzysztof Wilczyński Signed-off-by: Bjorn Helgaas Tested-by: Magnus Lindholm Tested-by: Shivaprasad G Bhat Reviewed-by: Ilpo Järvinen Acked-by: Magnus Lindholm Link: https://patch.msgid.link/20260508043543.217179-12-kwilczynski@kernel.org Signed-off-by: Sasha Levin --- arch/alpha/kernel/pci-sysfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index 5808a66e2a81f7..80a5fd642e7f32 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include @@ -71,7 +72,11 @@ static int pci_mmap_resource(struct kobject *kobj, struct resource *res = attr->private; enum pci_mmap_state mmap_type; struct pci_bus_region bar; - int i; + int i, ret; + + ret = security_locked_down(LOCKDOWN_PCI_ACCESS); + if (ret) + return ret; for (i = 0; i < PCI_STD_NUM_BARS; i++) if (res == &pdev->resource[i]) -- 2.53.0