Re: Crash in acpi_ns_validate_handle triggered by soundwire on Linux 5.10

Pierre-Louis Bossart
2021-01-26T01:55:27Z

>>>> Linux 5.10 fails to boot on my IceLake laptop, where 5.9 worked fine.
>>>> I'm not sure whether it's a bug in ACPI or Soundwire subsystem, so I'm
>>>> sending this to both
>>>> lists. The W taint flag is because of an unrelated nouveau failure (It
>>>> was busted on 5.9, and is
>>>> still on 5.10). Full kernel log down below.
>>>> It's from a distro kernel, but I can build my own kernel with patches if needed.
>>>
>>> Please try to add a check for handle against NULL to
>>> snd_intel_dsp_check_soundwire() after
>>>
>>> handle = ACPI_HANDLE(&pci->dev);
>>>
>>> and see if this makes any difference.
>>>
>>> This should check handle against NULL anyway, even if it didn't crash later on.
>>
>> Is there a way you can share the DSDT?
>>
>> The only thing we do in that sdw_intel_acpi_scan() function is check for an
>> _ADR and read two _DSD properties. I think it's been 2 years since we wrote
>> it and never had an issue, never say never I guess...
>>
>> If you want to bypass this problem for the time being, you can add a kernel
>> option in /etc/modprobe.d/alsa-base.conf
>>
>> options snd-intel-dspcfg dsp_driver=1
>>
>> that will force the use of the HDaudio legacy driver and bypass the driver
>> autodetection.
>
> A user in Debian, Kubo Hiroshi reported what seems to be the same
> issue in https://bugs.debian.org/981003 .

Thanks for connecting the dots.

I can only suggest the following patch, similar to what Rafael suggested
but this time done inside of the sdw_intel_acpi_scan() function which
has multiple users.

I still don't see what happens though, the code in drivers/acpi seems to
already check for bad pointers?

diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index cabdadb09a1b..91f57f75a9e2 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -405,6 +405,9 @@ int sdw_intel_acpi_scan(acpi_handle *parent_handle,
{
acpi_status status;

+ if (!parent_handle)
+ return -ENODEV;
+
status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
parent_handle, 1,
sdw_intel_acpi_cb,