Skip to content

Commit d2cf909

Browse files
Frederic Barratmpe
authored andcommitted
powerpc/mm: Prevent unlikely crash in copro_calculate_slb()
If a cxl adapter faults on an invalid address for a kernel context, we may enter copro_calculate_slb() with a NULL mm pointer (kernel context) and an effective address which looks like a user address. Which will cause a crash when dereferencing mm. It is clearly an AFU bug, but there's no reason to crash either. So return an error, so that cxl can ack the interrupt with an address error. Fixes: 73d16a6 ("powerpc/cell: Move data segment faulting code out of cell platform") Cc: [email protected] # v3.18+ Signed-off-by: Frederic Barrat <[email protected]> Acked-by: Ian Munsie <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 1001354 commit d2cf909

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/powerpc/mm/copro_fault.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
106106
switch (REGION_ID(ea)) {
107107
case USER_REGION_ID:
108108
pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea);
109+
if (mm == NULL)
110+
return 1;
109111
psize = get_slice_psize(mm, ea);
110112
ssize = user_segment_size(ea);
111113
vsid = get_vsid(mm->context.id, ea, ssize);

0 commit comments

Comments
 (0)