[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190208121341.GD13009@e107981-ln.cambridge.arm.com>
Date: Fri, 8 Feb 2019 12:13:41 +0000
From: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
To: Stefan Agner <stefan@...er.ch>
Cc: hongxing.zhu@....com, l.stach@...gutronix.de, robin.murphy@....com,
tpiepho@...inj.com, linux@...linux.org.uk, leonard.crestez@....com,
andrew.smirnov@...il.com, festevam@...il.com, bhelgaas@...gle.com,
linux-pci@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] pci: imx6: avoid dereferencing program counter
from user mode
On Tue, Dec 04, 2018 at 02:27:32PM +0100, Stefan Agner wrote:
> 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@...er.ch>
> ---
> drivers/pci/controller/dwc/pci-imx6.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
If this series is still aimed at mainline I need Lucas' ACK to
merge it.
Lorenzo
> 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
>
Powered by blists - more mailing lists