Skip to contentSkip to conversation

patch "tty: mxs-auart: fix a potential NULL pointer dereference" added to tty-linus

PATCH [email protected] 1 participant 1 message Mar 19, 2019

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tty: mxs-auart: fix a potential NULL pointer dereference

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 6734330654dac550f12e932996b868c6d0dcb421 Mon Sep 17 00:00:00 2001
From: Kangjie Lu <[email protected]>
Date: Thu, 14 Mar 2019 02:21:51 -0500
Subject: 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.

---
 drivers/tty/serial/mxs-auart.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/tty/serial/mxs-auart.c +4 -0
index 27235a526cce..4c188f4079b3 100644
@@ -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;
Signature · 1 line
2.21.0