From 6e3f0df4d4493b1ee5a9334718ad423f8d878719 Mon Sep 17 00:00:00 2001 From: Niklas Schnelle Date: Thu, 12 Jun 2025 19:43:04 +0200 Subject: [PATCH] s390/pci: Fix missing check for zpci_create_device() error return BugLink: https://bugs.launchpad.net/bugs/2114174 The zpci_create_device() function returns an error pointer that needs to be checked before dereferencing it as a struct zpci_dev pointer. Add the missing check in __clp_add() where it was missed when adding the scan_list in the fixed commit. Simply not adding the device to the scan list results in the previous behavior. Cc: stable@vger.kernel.org Fixes: 0467cdde8c43 ("s390/pci: Sort PCI functions prior to creating virtual busses") Signed-off-by: Niklas Schnelle Reviewed-by: Gerd Bayer Signed-off-by: Heiko Carstens (cherry picked from commit 42420c50c68f3e95e90de2479464f420602229fc) CVE-2025-37974 Signed-off-by: Massimiliano Pellizzer Acked-by: Edoardo Canepa Acked-by: Manuel Diewald Acked-by: Mehmet Basaran Signed-off-by: Mehmet Basaran --- arch/s390/pci/pci_clp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c index 421c95e1841e..c1625282638d 100644 --- a/arch/s390/pci/pci_clp.c +++ b/arch/s390/pci/pci_clp.c @@ -422,6 +422,8 @@ static void __clp_add(struct clp_fh_list_entry *entry, void *data) return; } zdev = zpci_create_device(entry->fid, entry->fh, entry->config_state); + if (IS_ERR(zdev)) + return; list_add_tail(&zdev->entry, scan_list); }