Skip to contentSkip to conversation

Patch "powerpc/mm: Prevent unlikely crash in copro_calculate_slb()" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Oct 26, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

powerpc/mm: Prevent unlikely crash in copro_calculate_slb()

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
powerpc-mm-prevent-unlikely-crash-in-copro_calculate_slb.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From d2cf909cda5f8c5609cb7ed6cda816c3e15528c7 Mon Sep 17 00:00:00 2001

From: Frederic Barrat <[email protected]>
Date: Fri, 17 Jun 2016 18:53:28 +0200
Subject: powerpc/mm: Prevent unlikely crash in copro_calculate_slb()

From: Frederic Barrat <[email protected]>

commit d2cf909cda5f8c5609cb7ed6cda816c3e15528c7 upstream.

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 73d16a6e0e51 ("powerpc/cell: Move data segment faulting code out of cell platform")
---
 arch/powerpc/mm/copro_fault.c |    2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/mm/copro_fault.c +2 -0
@@ -106,6 +106,8 @@ int copro_calculate_slb(struct mm_struct
 	switch (REGION_ID(ea)) {
 	case USER_REGION_ID:
 		pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea);
+		if (mm == NULL)
+			return 1;
 		psize = get_slice_psize(mm, ea);
 		ssize = user_segment_size(ea);
 		vsid = get_vsid(mm->context.id, ea, ssize);

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/powerpc-mm-prevent-unlikely-crash-in-copro_calculate_slb.patch