Skip to content

Commit 9aa030c

Browse files
Marc Zyngieroupton
authored andcommitted
arm64: cpufeatures: Fix FEAT_NV check when checking for FEAT_NV1
Using this_cpu_has_cap() has the potential to go wrong when used system-wide on a preemptible kernel. Instead, use the __system_matches_cap() helper when checking for FEAT_NV in the FEAT_NV1 probing helper. Fixes: 3673d01 ("arm64: cpufeatures: Only check for NV1 if NV is present") Reported-by: Marek Szyprowski <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Link: https://lore.kernel.org/kvmarm/[email protected]/ Signed-off-by: Oliver Upton <[email protected]>
1 parent 3673d01 commit 9aa030c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ static bool has_nv1(const struct arm64_cpu_capabilities *entry, int scope)
18121812
{}
18131813
};
18141814

1815-
return (this_cpu_has_cap(ARM64_HAS_NESTED_VIRT) &&
1815+
return (__system_matches_cap(ARM64_HAS_NESTED_VIRT) &&
18161816
!(has_cpuid_feature(entry, scope) ||
18171817
is_midr_in_range_list(read_cpuid_id(), nv1_ni_list)));
18181818
}

0 commit comments

Comments
 (0)