Re: commit 7b025f3f85ed causes NULL pointer dereference

Aithal, Srikanth
2025-04-09T11:44:30Z

On 4/9/2025 2:16 AM, Thomas Gleixner wrote:
> 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;
> }
>

I too hit the same issue. The patch above, applied on top of
next-20250409, resolves the issue.

Thank you.

Tested-by: Srikanth Aithal <sraithal@amd.com>