From: Greg Kroah-Hartman Date: Mon, 16 May 2022 15:18:06 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.9.315~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ef359dd92aa1f686a2935c9cc5c0bc7e11c446d9;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: tty-serial-digicolor-fix-possible-null-ptr-deref-in-digicolor_uart_probe.patch --- diff --git a/queue-5.4/series b/queue-5.4/series index f5146536f29..fe642a571ea 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -40,3 +40,4 @@ mips-fix-build-with-gcc-12.patch net-phy-fix-race-condition-on-link-status-change.patch arm-memremap-don-t-abuse-pfn_valid-to-ensure-presence-of-linear-map.patch ping-fix-address-binding-wrt-vrf.patch +tty-serial-digicolor-fix-possible-null-ptr-deref-in-digicolor_uart_probe.patch diff --git a/queue-5.4/tty-serial-digicolor-fix-possible-null-ptr-deref-in-digicolor_uart_probe.patch b/queue-5.4/tty-serial-digicolor-fix-possible-null-ptr-deref-in-digicolor_uart_probe.patch new file mode 100644 index 00000000000..cfbe8ecee5e --- /dev/null +++ b/queue-5.4/tty-serial-digicolor-fix-possible-null-ptr-deref-in-digicolor_uart_probe.patch @@ -0,0 +1,38 @@ +From 447ee1516f19f534a228dda237eddb202f23e163 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Thu, 5 May 2022 20:46:21 +0800 +Subject: tty/serial: digicolor: fix possible null-ptr-deref in digicolor_uart_probe() + +From: Yang Yingliang + +commit 447ee1516f19f534a228dda237eddb202f23e163 upstream. + +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. + +Fixes: 5930cb3511df ("serial: driver for Conexant Digicolor USART") +Signed-off-by: Yang Yingliang +Reviewed-by: Baruch Siach +Cc: stable +Link: https://lore.kernel.org/r/20220505124621.1592697-1-yangyingliang@huawei.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/digicolor-usart.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/tty/serial/digicolor-usart.c ++++ b/drivers/tty/serial/digicolor-usart.c +@@ -472,10 +472,10 @@ static int digicolor_uart_probe(struct p + 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); + 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)