4.15-stable review patch. If anyone has any objections, please let me know.
------------------ From: James Morse <james.mo...@arm.com> Commit edf298cfce47 upstream. this_cpu_has_cap() tests caps->desc not caps->matches, so it stops walking the list when it finds a 'silent' feature, instead of walking to the end of the list. Prior to v4.6's 644c2ae198412 ("arm64: cpufeature: Test 'matches' pointer to find the end of the list") we always tested desc to find the end of a capability list. This was changed for dubious things like PAN_NOT_UAO. v4.7's e3661b128e53e ("arm64: Allow a capability to be checked on single CPU") added this_cpu_has_cap() using the old desc style test. CC: Suzuki K Poulose <suzuki.poul...@arm.com> Reviewed-by: Suzuki K Poulose <suzuki.poul...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> Signed-off-by: James Morse <james.mo...@arm.com> Signed-off-by: Catalin Marinas <catalin.mari...@arm.com> Signed-off-by: Will Deacon <will.dea...@arm.com> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- arch/arm64/kernel/cpufeature.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1173,9 +1173,8 @@ static bool __this_cpu_has_cap(const str if (WARN_ON(preemptible())) return false; - for (caps = cap_array; caps->desc; caps++) + for (caps = cap_array; caps->matches; caps++) if (caps->capability == cap && - caps->matches && caps->matches(caps, SCOPE_LOCAL_CPU)) return true; return false;