Skip to content

Commit e6ec07d

Browse files
hcahcaVasily Gorbik
authored andcommitted
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: 64c3431 ("s390/entry: compare gmap asce to determine guest/host fault") Acked-by: Sven Schnelle <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 39cd87c commit e6ec07d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/s390/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static enum fault_type get_fault_type(struct pt_regs *regs)
7575
if (!IS_ENABLED(CONFIG_PGSTE))
7676
return KERNEL_FAULT;
7777
gmap = (struct gmap *)S390_lowcore.gmap;
78-
if (regs->cr1 == gmap->asce)
78+
if (gmap && gmap->asce == regs->cr1)
7979
return GMAP_FAULT;
8080
return KERNEL_FAULT;
8181
}

0 commit comments

Comments
 (0)