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

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

diff --git a/queue-4.14/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch b/queue-4.14/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch
new file mode 100644 (file)
index 0000000..c0c05c1
--- /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
+@@ -308,8 +308,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) {
+@@ -325,7 +323,7 @@ static int ipip6_tunnel_get_prl(struct i
+               }
+       }
+-      c = 0;
++      rcu_read_lock();
+       for_each_prl_rcu(t->prl) {
+               if (c >= cmax)
+                       break;
+@@ -337,7 +335,7 @@ static int ipip6_tunnel_get_prl(struct i
+               if (kprl.addr != htonl(INADDR_ANY))
+                       break;
+       }
+-out:
++
+       rcu_read_unlock();
+       len = sizeof(*kp) * c;
+@@ -346,7 +344,7 @@ out:
+               ret = -EFAULT;
+       kfree(kp);
+-
++out:
+       return ret;
+ }
index 91a97acdea1895acb6d78c9a319bd4d7a3a461b4..b9be46df7809059bdf050669a91b4aa46b232b5e 100644 (file)
@@ -17,3 +17,5 @@ nfc-nxp-nci-don-t-issue-a-zero-length-i2c_master_read.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-4.14/sit-use-min.patch b/queue-4.14/sit-use-min.patch
new file mode 100644 (file)
index 0000000..e91b5b8
--- /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
+@@ -310,7 +310,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