s390/mm: fix NULL pointer dereference
authorHeiko Carstens <hca@linux.ibm.com>
Wed, 20 Mar 2024 09:38:58 +0000 (10:38 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 3 Apr 2024 13:00:19 +0000 (15:00 +0200)
commite6ec07dc6dd498415bc8cc49437d5ec9e09cc48e
tree4f1711fba6b65705dcfbe6f9928e7f7105e03b7c
parent39cd87c4eb2b893354f3b850f916353f2658ae6f
s390/mm: fix NULL pointer dereference

The recently added check to figure out if a fault happened on gmap ASCE
dereferences the gmap pointer in lowcore without checking that it is not
NULL. For all non-KVM processes the pointer is NULL, so that some value
from lowcore will be read. With the current layouts of struct gmap and
struct lowcore the read value (aka ASCE) is zero, so that this doesn't lead
to any observable bug; at least currently.

Fix this by adding the missing NULL pointer check.

Fixes: 64c3431808bd ("s390/entry: compare gmap asce to determine guest/host fault")
Acked-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/mm/fault.c