linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] pci: imx6: avoid dereferencing program counter from user mode
@ 2018-12-04 13:27 Stefan Agner
  2018-12-04 13:27 ` [PATCH v2 2/2] pci: imx6: support kernels built in Thumb-2 mode Stefan Agner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefan Agner @ 2018-12-04 13:27 UTC (permalink / raw)
  To: hongxing.zhu, l.stach
  Cc: lorenzo.pieralisi, andrew.smirnov, robin.murphy, linux, stefan,
	linux-kernel, linux-pci, bhelgaas, leonard.crestez, festevam,
	linux-arm-kernel, tpiepho

The custom fault handler is currently only meant to handle kernel
mode bus faults. Exit in case the abort happened in user mode.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/pci/controller/dwc/pci-imx6.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 69f86234f7c0..54a29e441303 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -270,8 +270,14 @@ static int imx6q_pcie_abort_handler(unsigned long addr,
 		unsigned int fsr, struct pt_regs *regs)
 {
 	unsigned long pc = instruction_pointer(regs);
-	unsigned long instr = *(unsigned long *)pc;
-	int reg = (instr >> 12) & 15;
+	unsigned long instr;
+	int reg;
+
+	if (user_mode(regs))
+		return 1;
+
+	instr = *(unsigned long *)pc;
+	reg = (instr >> 12) & 15;
 
 	/*
 	 * If the instruction being executed was a read,
-- 
2.19.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-11 16:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 13:27 [PATCH v2 1/2] pci: imx6: avoid dereferencing program counter from user mode Stefan Agner
2018-12-04 13:27 ` [PATCH v2 2/2] pci: imx6: support kernels built in Thumb-2 mode Stefan Agner
2019-02-11 16:57   ` Lucas Stach
2019-02-08 12:13 ` [PATCH v2 1/2] pci: imx6: avoid dereferencing program counter from user mode Lorenzo Pieralisi
2019-02-11 16:56 ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).