Re: kernel NULL pointer dereference in quirk_clear_strap_no_soft_reset_dev2_f0 -> amd_smn_read

Marek Marczykowski-Górecki <[email protected]>
Newsgroups dev.linux.lists.regressions,org.kernel.vger.linux-kernel
Message-ID <aiMIiOzJejNV1tCL@mail-itl>
On Mon, Jan 12, 2026 at 08:47:50PM -0600, Mario Limonciello wrote:
> 
> 
> On 1/12/2026 7:01 PM, Marek Marczykowski-Górecki wrote:
> > Hi,
> > 
> > I've got a report that kernel 6.17.9 crashes when running a Xen HVM domU
> > with AMD Raphael/Granite Ridge USB controller passed through.
> > It worked correctly in 6.12.59. Between those versions, I don't see any
> > relevant change to quirk_clear_strap_no_soft_reset_dev2_f0() function,
> > but the AMD node driver did got some changes, so my guess is one of them
> > is to blame. I know the good-bad range is huge, but there aren't that
> > many changes to the AMD node driver in this range.
> 
> Is this perhaps a case that only the USB controller was passed through but
> that the root controller wasn't?  That would lead to a case that
> amd_smn_init() was never called and thus amd_roots was not initialized
> properly.
> 
> So it would be a NULL pointer deref.  If that's correct, something like this
> should work to avoid it.
> 
> diff --git a/arch/x86/kernel/amd_node.c b/arch/x86/kernel/amd_node.c
> index 3d0a4768d603c..894823b444d47 100644
> --- a/arch/x86/kernel/amd_node.c
> +++ b/arch/x86/kernel/amd_node.c
> @@ -91,6 +91,11 @@ static int __amd_smn_rw(u8 i_off, u8 d_off, u16 node, u32
> address, u32 *value, b
>         if (node >= amd_num_nodes())
>                 return err;
> 
> +       if (!amd_roots) {
> +               pr_warn("AMD SMN roots not initialized.\n");
> +               return err;
> +       }
> +
>         root = amd_roots[node];
>         if (!root)
>                 return err;

Thanks, I finally got confirmation from affected user that this patch
fixes the issue. From what I understand, adbf61cc47cb ("x86/acpi/boot: Correct
acpi_is_processor_usable() check again") was not enough.

> > Original report at (with full kernel log etc): https://forum.qubes-os.org/t/yet-another-usb-keyboard-thread/38355/8

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmojCIgACgkQ24/THMrX
1yzzhAf+Iogj+9gfdBQuxwl4pGyWGFXAiJz1gEVKYHbtWX0ib7w+emSzELpQ5rWb
yT0U0sqUIG7X4QrpSu4wA7x4RoA9a0EQ8dl5PdILGy9X5cxKKnuZ2S6G2sFUKrGh
j0uAo6nyuXeVTqxl3RNeMUyzjzPLItK8EopJbegj6C3+FnUDBR3QqpDBKDkwzrku
mPKLxcE+aj1/mH2Lmn3dhcMic60UJna0Fq5Om4GC926d0TYkd8eWgqkS0WUSjkQu
TrZXn/weKhCv7JdAI6oPJYAa/S62+lTi6WsabYRBFfhCilj8T2T/Gad8vsTvdg3G
+DqW/cuy/J0b9xUC84Mryzz3I0wL+A==
=Ivh3
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.