diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-14 02:21:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-19 15:37:43 +0100 |
commit | 6734330654dac550f12e932996b868c6d0dcb421 (patch) | |
tree | 114dd5fdf29e9d09dbecc8bac7146e965f25d508 /drivers/tty | |
parent | c85be041065c0be8bc48eda4c45e0319caf1d0e5 (diff) | |
download | linux-stable-6734330654dac550f12e932996b868c6d0dcb421.tar.gz linux-stable-6734330654dac550f12e932996b868c6d0dcb421.tar.bz2 linux-stable-6734330654dac550f12e932996b868c6d0dcb421.zip |
tty: mxs-auart: fix a potential NULL pointer dereference
In case ioremap fails, the fix returns -ENOMEM to avoid NULL
pointer dereferences.
Multiple places use port.membase.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/mxs-auart.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 27235a526cce..4c188f4079b3 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -1686,6 +1686,10 @@ static int mxs_auart_probe(struct platform_device *pdev) s->port.mapbase = r->start; s->port.membase = ioremap(r->start, resource_size(r)); + if (!s->port.membase) { + ret = -ENOMEM; + goto out_disable_clks; + } s->port.ops = &mxs_auart_ops; s->port.iotype = UPIO_MEM; s->port.fifosize = MXS_AUART_FIFO_SIZE; |