summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
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-27 11:04:06 +0100
commit81159a6b064142b993f2f39828b77e199c77872a (patch)
treea38bebffe416ba32b628c679c1a26520ff05060f /drivers/tty/serial
parent155453ada562c450a4ff5fcf4852b9fa5b6b793a (diff)
downloadlinux-81159a6b064142b993f2f39828b77e199c77872a.tar.gz
linux-81159a6b064142b993f2f39828b77e199c77872a.tar.bz2
linux-81159a6b064142b993f2f39828b77e199c77872a.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/serial')
-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 8f2cab7f66ad..d9f094514945 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;