From: Shao Mingyin pata_buddha_probe() returns success even if ata_host_activate() fails to start the host, request its IRQ or register its ports. This leaves a Buddha or Catweasel device bound without usable ATA ports and allows the remove callback to detach an unregistered host. Return the activation error so that the driver core rejects the binding and releases the resources allocated during probe. Fixes: 12ce6b0d21c2 ("ata/pata_buddha: Probe via modalias instead of initcall") Cc: stable@vger.kernel.org Signed-off-by: Shao Mingyin --- Tested on 7.4.0-rc1-next-20261105 under QEMU/TCG (m68k virt), with SLUB debugging. Both kernels use the same TEST-ONLY harness, which registers synthetic Buddha and Catweasel devices on the real Zorro bus and calls the original probe. RAM represents board registers; dummy port methods and invalid IRQ/SCSI parameters exercise the real ata_host_activate() failure paths. Only this fix differs. In 20 scenarios per kernel, all 16 activation failures incorrectly bind the device and retain its managed resources on the unpatched kernel. With the fix, probe preserves -ENOMEM/-EBUSY/-EINVAL, leaves the device unbound and releases the MMIO region and devres immediately. Four successful controls still register and detach normally. A guard records and skips unsafe detach of unregistered hosts on the unpatched kernel; no crash is claimed. AutoConfig hardware discovery, physical IRQ/PIO, disk I/O and the manual X-Surf path were not tested. drivers/ata/pata_buddha.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ata/pata_buddha.c b/drivers/ata/pata_buddha.c index 5a580ef4fb..bc8719e5d5 100644 --- a/drivers/ata/pata_buddha.c +++ b/drivers/ata/pata_buddha.c @@ -238,10 +238,8 @@ static int pata_buddha_probe(struct zorro_dev *z, ctl ? board + buddha_bases[i] + ctl : 0); } - ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt, - IRQF_SHARED, &pata_buddha_sht); - - return 0; + return ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt, + IRQF_SHARED, &pata_buddha_sht); } static void pata_buddha_remove(struct zorro_dev *z) -- 2.27.0