Commit 67343306 authored by Kangjie Lu's avatar Kangjie Lu Committed by Greg Kroah-Hartman

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: default avatarKangjie Lu <kjlu@umn.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c85be041
...@@ -1686,6 +1686,10 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1686,6 +1686,10 @@ static int mxs_auart_probe(struct platform_device *pdev)
s->port.mapbase = r->start; s->port.mapbase = r->start;
s->port.membase = ioremap(r->start, resource_size(r)); 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.ops = &mxs_auart_ops;
s->port.iotype = UPIO_MEM; s->port.iotype = UPIO_MEM;
s->port.fifosize = MXS_AUART_FIFO_SIZE; s->port.fifosize = MXS_AUART_FIFO_SIZE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment