From: Lucas Stach <l.stach@pengutronix.de>
To: Stefan Agner <stefan@agner.ch>, hongxing.zhu@nxp.com
Cc: lorenzo.pieralisi@arm.com, andrew.smirnov@gmail.com,
robin.murphy@arm.com, linux@armlinux.org.uk,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
bhelgaas@google.com, leonard.crestez@nxp.com, festevam@gmail.com,
linux-arm-kernel@lists.infradead.org, tpiepho@impinj.com
Subject: Re: [PATCH v2 1/2] pci: imx6: avoid dereferencing program counter from user mode
Date: Mon, 11 Feb 2019 17:56:05 +0100 [thread overview]
Message-ID: <1549904165.2546.14.camel@pengutronix.de> (raw)
In-Reply-To: <20181204132733.14422-1-stefan@agner.ch>
Am Dienstag, den 04.12.2018, 14:27 +0100 schrieb Stefan Agner:
> 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>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> 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,
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-02-11 16:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1549904165.2546.14.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=andrew.smirnov@gmail.com \
--cc=bhelgaas@google.com \
--cc=festevam@gmail.com \
--cc=hongxing.zhu@nxp.com \
--cc=leonard.crestez@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo.pieralisi@arm.com \
--cc=robin.murphy@arm.com \
--cc=stefan@agner.ch \
--cc=tpiepho@impinj.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).