perf/x86/intel/uncore: Fix NULL pointer dereference issue in upi_fill_topology()
authorAlexander Antonov <alexander.antonov@linux.intel.com>
Mon, 27 Nov 2023 18:52:45 +0000 (10:52 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:14 +0000 (15:35 -0800)
commitbf1bf09e6b599758851457f3999779622a48d015
tree5d35fc44a336a5c61af69ad330811a5fc5646a11
parent20c09814782b5a174fd3388611f8f4a4784c9eba
perf/x86/intel/uncore: Fix NULL pointer dereference issue in upi_fill_topology()

[ Upstream commit 1692cf434ba13ee212495b5af795b6a07e986ce4 ]

Get logical socket id instead of physical id in discover_upi_topology()
to avoid out-of-bound access on 'upi = &type->topology[nid][idx];' line
that leads to NULL pointer dereference in upi_fill_topology()

Fixes: f680b6e6062e ("perf/x86/intel/uncore: Enable UPI topology discovery for Icelake Server")
Reported-by: Kyle Meyer <kyle.meyer@hpe.com>
Signed-off-by: Alexander Antonov <alexander.antonov@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Tested-by: Kyle Meyer <kyle.meyer@hpe.com>
Link: https://lore.kernel.org/r/20231127185246.2371939-2-alexander.antonov@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/events/intel/uncore_snbep.c