From: Greg Kroah-Hartman Date: Mon, 19 Jul 2021 13:06:08 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.13.4~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54b614e8d07382c81b73c86c20fc0512fbdc6754;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: net-moxa-use-devm_platform_get_and_ioremap_resource.patch --- diff --git a/queue-5.4/net-moxa-use-devm_platform_get_and_ioremap_resource.patch b/queue-5.4/net-moxa-use-devm_platform_get_and_ioremap_resource.patch new file mode 100644 index 00000000000..410cb3b48fb --- /dev/null +++ b/queue-5.4/net-moxa-use-devm_platform_get_and_ioremap_resource.patch @@ -0,0 +1,36 @@ +From 35cba15a504bf4f585bb9d78f47b22b28a1a06b2 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Mon, 7 Jun 2021 23:02:59 +0800 +Subject: net: moxa: Use devm_platform_get_and_ioremap_resource() + +From: Yang Yingliang + +commit 35cba15a504bf4f585bb9d78f47b22b28a1a06b2 upstream. + +Use devm_platform_get_and_ioremap_resource() to simplify +code and avoid a null-ptr-deref by checking 'res' in it. + +[yyl: since devm_platform_get_and_ioremap_resource() is introduced + in linux-5.7, so just check the return value after calling + platform_get_resource()] + +Signed-off-by: Yang Yingliang +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/moxa/moxart_ether.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/net/ethernet/moxa/moxart_ether.c ++++ b/drivers/net/ethernet/moxa/moxart_ether.c +@@ -481,6 +481,10 @@ static int moxart_mac_probe(struct platf + priv->pdev = pdev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ if (!res) { ++ ret = -EINVAL; ++ goto init_fail; ++ } + ndev->base_addr = res->start; + priv->base = devm_ioremap_resource(p_dev, res); + if (IS_ERR(priv->base)) { diff --git a/queue-5.4/series b/queue-5.4/series index 020f3021095..82433b7cfc6 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -5,3 +5,4 @@ scsi-core-fix-bad-pointer-dereference-when-ehandler-kthread-is-invalid.patch tracing-do-not-reference-char-as-a-string-in-histograms.patch cgroup-verify-that-source-is-a-string.patch fbmem-do-not-delete-the-mode-that-is-still-in-use.patch +net-moxa-use-devm_platform_get_and_ioremap_resource.patch