Re: commit 7b025f3f85ed causes NULL pointer dereference

Thomas Gleixner
2025-04-08T20:46:14Z

On Tue, Apr 08 2025 at 18:20, Bert Karwatzki wrote:
> Am Dienstag, dem 08.04.2025 um 17:29 +0200 schrieb Thomas Gleixner:
>> > Can you please decode the lines please via:
>> >
>> > scripts/faddr2line vmlinux msi_domain_first_desc+0x4/0x30
>> > scripts/faddr2line vmlinux msix_setup_interrupts+0x23b/0x280
>>
>
> I had to recompile with CONFIG_DEBUG_INFO=Y, and reran the test, the calltrace
> is identical.
>
> $ scripts/faddr2line vmlinux msi_domain_first_desc+0x4/0x30
> msi_domain_first_desc+0x4/0x30:
> msi_domain_first_desc at kernel/irq/msi.c:400
>
> So it seems msi_domain_first_desc() is called with dev = NULL.

Yup

> $ scripts/faddr2line vmlinux msix_setup_interrupts+0x23b/0x280
> msix_setup_interrupts+0x23b/0x280:
> msix_update_entries at drivers/pci/msi/msi.c:647 (discriminator 1)

Aaarg. The patch below should fix that.

Thanks,

tglx
---
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 4027abcafe7a..77cc27e45b66 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -680,8 +680,8 @@ static int __msix_setup_interrupts(struct pci_dev *__dev, struct msix_entry *ent
if (ret)
return ret;

- retain_ptr(dev);
msix_update_entries(dev, entries);
+ retain_ptr(dev);
return 0;
}