diff options
| author | Jason Andryuk <jason.andryuk@amd.com> | 2026-08-25 17:48:03 -0400 |
|---|---|---|
| committer | Borislav Petkov (AMD) <bp@alien8.de> | 2026-09-02 13:52:15 -0700 |
| commit | 60714fb1d494e11d1eb54b0aef45e250c51279a8 (patch) | |
| tree | ebd71cb0930c255a431053ea378d5fc9bdf5cf50 /scripts/Makefile.thinlto | |
| parent | 453e7859443446b837d905d6f2983a76c867247d (diff) | |
| download | linux-next-60714fb1d494e11d1eb54b0aef45e250c51279a8.tar.gz linux-next-60714fb1d494e11d1eb54b0aef45e250c51279a8.zip | |
x86/amd_node: Prevent potential NULL pointer dereference
amd_smn_read/write() are exported functions around __amd_smn_rw(), so
they are always available even if amd_smn_init() fails. In that case,
amd_roots is NULL and __amd_smn_rw() will access uninitialized memory.
Then, commit
83518453074d ("x86/amd_node: Add SMN offsets to exclusive region access")
added smn_exclusive which indicated the calls to
pci_request_config_region_exclusive() succeeded to prevent concurrent
userspace access.
Commit
0a4b61d9c2e4 ("x86/amd_node: Fix AMD root device caching")
re-ordered initialization so pci_request_config_region_exclusive() is called
earlier and a failure exits amd_smn_init() before allocating amd_roots.
Setting smn_exclusive moved to the end of amd_smn_init(), after amd_roots is
allocated. It became redundant and can be removed.
Replace smn_exclusive with directly checking amd_roots to avoid a potential
NULL pointer dereference.
[ bp: Reorg commit message, touchup comment. ]
Fixes: 77466b798d59 ("x86/amd_node: Remove dependency on AMD_NB")
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260825214805.39148-3-jason.andryuk@amd.com
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
