Re: kernel NULL pointer dereference in quirk_clear_strap_no_soft_reset_dev2_f0 -> amd_smn_read

From: Borislav Petkov

Date: Fri Jun 05 2026 - 22:00:31 EST


On Sat, Jun 06, 2026 at 01:37:03AM +0200, Marek Marczykowski-Górecki wrote:
> Is it actually guaranteed to run before PCI fixups? They are done via
> fs_initcall_sync.

Yap, the sync initcalls run after the respective level initcalls.

> IMO it would be safer to guard __amd_smn_rw() with something that would also
> detect calls before amd_smn_init() is called. Like using smn_exclusive in
> the Penny's patch, or amd_roots in the Mario's patch.

I can do this if absolutely necessary:

static bool amd_node_off = true;

and then set it accordingly in the init function but I don't think that's
needed.

> That said, amd_smn_read() called before amd_smn_init() would (should?)
> fail anyway, even in non-virtualized case. So, maybe this approach
> (still crash on NULL ptr when called before amd_smn_init()) is
> acceptable?

Right, then we can hear about it and see who's doing what shenanigans.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette