summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorHenry Martin <bsdhenrymartin@gmail.com>2025-04-03 15:03:39 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-19 15:32:11 +0200
commitc23d87b43f7dba5eb12820f6cf21a1cd4f63eb3d (patch)
tree4a4af77b9923092a5c32d104d1263135c3c2474d /drivers/tty
parentd4c368e4a638ddf4a9d6d687b0ff691aa46cce53 (diff)
downloadlinux-c23d87b43f7dba5eb12820f6cf21a1cd4f63eb3d.tar.gz
linux-c23d87b43f7dba5eb12820f6cf21a1cd4f63eb3d.tar.bz2
linux-c23d87b43f7dba5eb12820f6cf21a1cd4f63eb3d.zip
serial: Fix potential null-ptr-deref in mlb_usio_probe()
[ Upstream commit 86bcae88c9209e334b2f8c252f4cc66beb261886 ] devm_ioremap() can return NULL on error. Currently, mlb_usio_probe() does not check for this case, which could result in a NULL pointer dereference. Add NULL check after devm_ioremap() to prevent this issue. Fixes: ba44dc043004 ("serial: Add Milbeaut serial control") Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> Link: https://lore.kernel.org/r/20250403070339.64990-1-bsdhenrymartin@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/milbeaut_usio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
index fb082ee73d5b..9b54f017f2e8 100644
--- a/drivers/tty/serial/milbeaut_usio.c
+++ b/drivers/tty/serial/milbeaut_usio.c
@@ -523,7 +523,10 @@ static int mlb_usio_probe(struct platform_device *pdev)
}
port->membase = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
-
+ if (!port->membase) {
+ ret = -ENOMEM;
+ goto failed;
+ }
ret = platform_get_irq_byname(pdev, "rx");
mlb_usio_irq[index][RX] = ret;