]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jul 2022 06:02:17 +0000 (08:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jul 2022 06:02:17 +0000 (08:02 +0200)
added patches:
ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch
sit-use-min.patch

queue-5.4/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/sit-use-min.patch [new file with mode: 0644]

diff --git a/queue-5.4/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch b/queue-5.4/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch
new file mode 100644 (file)
index 0000000..23a749f
--- /dev/null
@@ -0,0 +1,62 @@
+From adabdd8f6acabc0c3fdbba2e7f5a2edd9c5ef22d Mon Sep 17 00:00:00 2001
+From: katrinzhou <katrinzhou@tencent.com>
+Date: Tue, 28 Jun 2022 11:50:30 +0800
+Subject: ipv6/sit: fix ipip6_tunnel_get_prl return value
+
+From: katrinzhou <katrinzhou@tencent.com>
+
+commit adabdd8f6acabc0c3fdbba2e7f5a2edd9c5ef22d upstream.
+
+When kcalloc fails, ipip6_tunnel_get_prl() should return -ENOMEM.
+Move the position of label "out" to return correctly.
+
+Addresses-Coverity: ("Unused value")
+Fixes: 300aaeeaab5f ("[IPV6] SIT: Add SIOCGETPRL ioctl to get/dump PRL.")
+Signed-off-by: katrinzhou <katrinzhou@tencent.com>
+Reviewed-by: Eric Dumazet<edumazet@google.com>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Link: https://lore.kernel.org/r/20220628035030.1039171-1-zys.zljxml@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/sit.c |    8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/net/ipv6/sit.c
++++ b/net/ipv6/sit.c
+@@ -310,8 +310,6 @@ static int ipip6_tunnel_get_prl(struct i
+               kcalloc(cmax, sizeof(*kp), GFP_KERNEL | __GFP_NOWARN) :
+               NULL;
+-      rcu_read_lock();
+-
+       ca = min(t->prl_count, cmax);
+       if (!kp) {
+@@ -327,7 +325,7 @@ static int ipip6_tunnel_get_prl(struct i
+               }
+       }
+-      c = 0;
++      rcu_read_lock();
+       for_each_prl_rcu(t->prl) {
+               if (c >= cmax)
+                       break;
+@@ -339,7 +337,7 @@ static int ipip6_tunnel_get_prl(struct i
+               if (kprl.addr != htonl(INADDR_ANY))
+                       break;
+       }
+-out:
++
+       rcu_read_unlock();
+       len = sizeof(*kp) * c;
+@@ -348,7 +346,7 @@ out:
+               ret = -EFAULT;
+       kfree(kp);
+-
++out:
+       return ret;
+ }
index b521eb63422f8d3aef2a58352200dd326f83eb1a..877be012c24bf9320b3ab745ff6677e4fed23466 100644 (file)
@@ -29,3 +29,5 @@ net-tun-avoid-disabling-napi-twice.patch
 xen-gntdev-avoid-blocking-in-unmap_grant_pages.patch
 hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch
 net-dsa-bcm_sf2-force-pause-link-settings.patch
+sit-use-min.patch
+ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch
diff --git a/queue-5.4/sit-use-min.patch b/queue-5.4/sit-use-min.patch
new file mode 100644 (file)
index 0000000..7dfb893
--- /dev/null
@@ -0,0 +1,34 @@
+From 284fda1eff8a8b27d2cafd7dc8fb423d13720f21 Mon Sep 17 00:00:00 2001
+From: kernel test robot <lkp@intel.com>
+Date: Sat, 27 Mar 2021 10:29:32 +0100
+Subject: sit: use min
+
+From: kernel test robot <lkp@intel.com>
+
+commit 284fda1eff8a8b27d2cafd7dc8fb423d13720f21 upstream.
+
+Opportunity for min()
+
+Generated by: scripts/coccinelle/misc/minmax.cocci
+
+CC: Denis Efremov <efremov@linux.com>
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: kernel test robot <lkp@intel.com>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/sit.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/ipv6/sit.c
++++ b/net/ipv6/sit.c
+@@ -312,7 +312,7 @@ static int ipip6_tunnel_get_prl(struct i
+       rcu_read_lock();
+-      ca = t->prl_count < cmax ? t->prl_count : cmax;
++      ca = min(t->prl_count, cmax);
+       if (!kp) {
+               /* We don't try hard to allocate much memory for