patch "tty/serial: digicolor: fix possible null-ptr-deref in" added to tty-linus
This is a note to let you know that I've just added the patch titled
tty/serial: digicolor: fix possible null-ptr-deref in
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 447ee1516f19f534a228dda237eddb202f23e163 Mon Sep 17 00:00:00 2001
From: Yang Yingliang <[email protected]>
Date: Thu, 5 May 2022 20:46:21 +0800
Subject: tty/serial: digicolor: fix possible null-ptr-deref in
digicolor_uart_probe()
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.
--- drivers/tty/serial/digicolor-usart.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/digicolor-usart.c +2 -3
@@ -471,11 +471,10 @@ static int digicolor_uart_probe(struct platform_device *pdev)if (IS_ERR (uart_clk))return PTR_ERR (uart_clk); - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - dp->port.mapbase = res->start; - dp->port.membase =devm_ioremap_resource (&pdev->dev, res); + dp->port.membase =devm_platform_get_and_ioremap_resource (pdev,0 , &res);if (IS_ERR (dp->port.membase))return PTR_ERR (dp->port.membase); + dp->port.mapbase = res->start; irq =platform_get_irq (pdev,0 );if (irq <0 )
Signature · 1 line
2.36.0