]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 13:06:08 +0000 (15:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 13:06:08 +0000 (15:06 +0200)
added patches:
net-moxa-use-devm_platform_get_and_ioremap_resource.patch

queue-5.4/net-moxa-use-devm_platform_get_and_ioremap_resource.patch [new file with mode: 0644]
queue-5.4/series

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 (file)
index 0000000..410cb3b
--- /dev/null
@@ -0,0 +1,36 @@
+From 35cba15a504bf4f585bb9d78f47b22b28a1a06b2 Mon Sep 17 00:00:00 2001
+From: Yang Yingliang <yangyingliang@huawei.com>
+Date: Mon, 7 Jun 2021 23:02:59 +0800
+Subject: net: moxa: Use devm_platform_get_and_ioremap_resource()
+
+From: Yang Yingliang <yangyingliang@huawei.com>
+
+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 <yangyingliang@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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)) {
index 020f3021095452ddab10144fb660b856a9e556d4..82433b7cfc676c09d8bff9daf19551ce8a024d39 100644 (file)
@@ -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