Re: [PATCH v3 3/3] s390/pci: Enable CONTEXT_ANALYSIS
| Newsgroups | org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: Pre-existing issues: - [High] Missing lock acquisition in zpci_remove_reserved_devices() leading to lockdep failure and state corruption. - [High] Race condition in zpci_event_avail_new_device() exposing an unlocked device to concurrent state changes. -- --- Patch [3]: [PATCH v3 3/3] s390/pci: Enable CONTEXT_ANALYSIS --- commit f14ecb575360924ecbbf3801f2b0b0e2ff3a2eeb Author: Heiko Carstens <[email protected]> s390/pci: Enable CONTEXT_ANALYSIS This commit enables CONTEXT_ANALYSIS in the s390 PCI Makefile since the code now compiles without warnings. > diff --git a/arch/s390/pci/Makefile b/arch/s390/pci/Makefile > index 1810e0944a4ed..b8be1316491b8 100644 > --- a/arch/s390/pci/Makefile > +++ b/arch/s390/pci/Makefile > @@ -3,6 +3,8 @@ > # Makefile for the s390 PCI subsystem. > # > > +CONTEXT_ANALYSIS := y > + [Severity: High] This is a pre-existing issue and was not introduced by the patch under review, but since context analysis is being enabled to catch locking issues, I noticed a missing lock acquisition that it might not be catching. In arch/s390/pci/pci.c:zpci_remove_reserved_devices(): list_for_each_entry_safe(zdev, tmp, &remove, entry) zpci_device_reserved(zdev); The function zpci_device_reserved() unconditionally asserts lockdep_assert_held(&zdev->state_lock). Will calling it here without holding zdev->state_lock lead to a lockdep failure or state corruption if accessed concurrently by sysfs or event handlers? [Severity: High] This is also a pre-existing issue not introduced by the patch under review, but there might be a race condition exposed here as well. In arch/s390/pci/pci_event.c:zpci_event_avail_new_device(): if (zpci_add_device(zdev)) { kfree(zdev); break; } zpci_scan_configured_device(zdev, ccdf->fh); Once zpci_add_device() publishes the device globally, can concurrent threads acquire zdev->state_lock and deconfigure the device while zpci_scan_configured_device() is still running unlocked? > obj-$(CONFIG_PCI) += pci.o pci_irq.o pci_clp.o \ > pci_event.o pci_debug.o pci_insn.o pci_mmio.o \ > pci_bus.o pci_kvm_hook.o pci_report.o pci_fixup.o -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3