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 <aiMLK1Hvk0Fmyimm@mail-itl>
On Fri, Jun 05, 2026 at 12:36:29PM -0500, Mario Limonciello wrote:
> 
> 
> On 6/5/26 12:34, Marek Marczykowski-Górecki wrote:
> > 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
> > 
> 
> There's another patch being discussed.  Could this help?
> 
> https://lore.kernel.org/all/20260602184823.GKah8ld2QJLm28xoa9@fat_crate.local/

Especially with 2/2 patch there, yes, looks like it would help too.

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

iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmojCysACgkQ24/THMrX
1yzTgwf/UvhLPdvx9+R09bwcO8tat1gTx6fT/kJGtTtN5tGL8K621az2TJdHnWQg
5PHim6m+2m3EIJV5ws7zz47GbsyzJq2R4/bpL4sLjEgm/yEFYFNy5EElnjsNqOTL
+b8rSSWOFK+aKA9eOYh76vUW/P5UE9Phjcy9tRk7S93TDabIqWnlFkkQdM/D3hv8
I2ZnPTTY1bkUET922x1yL29zPzhyWRfSY1g8ZPPj5FOEgn9vx+5kqEREJf1Qj8DW
qC5fBqzTjQ58odqKnxdJDLOa7WzbvUloX/qYtpDqw7jfQSPst9jzGkloEosSoPRQ
QF4o4Ylc0V78yg+VOY5eNDoZ+/UjxQ==
=a3ky
-----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.