UBUNTU: SAUCE: cacheinfo: Check for null last-level cache info
BugLink: https://bugs.launchpad.net/bugs/2049793 Before determining the validity of the last-level cache info, ensure that it has been allocated. Simply checking for non-zero cache_leaves() is not sufficient, as some architectures (e.g., Intel processors) have non-zero cache_leaves() before allocation. Dereferencing NULL cacheinfo can occur in update_per_cpu_data_slice_size(). This function iterates over all online CPUs. However, a CPU may have come online recently, but its cacheinfo may not have been allocated yet. Cc: Andreas Herrmann <aherrmann@suse.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Chen Yu <yu.c.chen@intel.com> Cc: Huang Ying <ying.huang@intel.com> Cc: Len Brown <len.brown@intel.com> Cc: Radu Rendec <rrendec@redhat.com> Cc: Pierre Gondois <Pierre.Gondois@arm.com> Cc: Pu Wen <puwen@hygon.cn> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Will Deacon <will@kernel.org> Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: stable@vger.kernel.org Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> (cherry-picked from https://lore.kernel.org/all/20231212222519.12834-2-ricardo.neri-calderon@linux.intel.com/raw) Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com> Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
committed by
Paolo Pisati
parent
8523dc7445
commit
fbb4036f8b
@@ -61,6 +61,9 @@ bool last_level_cache_is_valid(unsigned int cpu)
|
||||
if (!cache_leaves(cpu))
|
||||
return false;
|
||||
|
||||
if (!per_cpu_cacheinfo(cpu))
|
||||
return false;
|
||||
|
||||
llc = per_cpu_cacheinfo_idx(cpu, cache_leaves(cpu) - 1);
|
||||
|
||||
return (llc->attributes & CACHE_ID) || !!llc->fw_token;
|
||||
|
||||
Reference in New Issue
Block a user