lib/test_lockup: fix kernel pointer check for separate address spaces
authorArnd Bergmann <arnd@arndb.de>
Wed, 16 Feb 2022 12:48:06 +0000 (13:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:24:01 +0000 (14:24 +0200)
commit6a1c70de40b500e0eee32292572b9b8d01f334c3
tree5207280b913744de3038fdd87cf0cea6bf0ef55f
parent8b2a6074b981488ceeabf5ef7b5f873340e75118
lib/test_lockup: fix kernel pointer check for separate address spaces

[ Upstream commit 5a06fcb15b43d1f7bf740c672950122331cb5655 ]

test_kernel_ptr() uses access_ok() to figure out if a given address
points to user space instead of kernel space. However on architectures
that set CONFIG_ALTERNATE_USER_ADDRESS_SPACE, a pointer can be valid
for both, and the check always fails because access_ok() returns true.

Make the check for user space pointers conditional on the type of
address space layout.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/test_lockup.c