From cfaf66864104a669d12b921791fae5e32bfa3f0a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 5 Jul 2022 08:02:10 +0200 Subject: [PATCH] 4.19-stable patches added patches: ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch sit-use-min.patch --- ...ix-ipip6_tunnel_get_prl-return-value.patch | 62 +++++++++++++++++++ queue-4.19/series | 2 + queue-4.19/sit-use-min.patch | 34 ++++++++++ 3 files changed, 98 insertions(+) create mode 100644 queue-4.19/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch create mode 100644 queue-4.19/sit-use-min.patch diff --git a/queue-4.19/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch b/queue-4.19/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch new file mode 100644 index 00000000000..c4ee4afd1a8 --- /dev/null +++ b/queue-4.19/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch @@ -0,0 +1,62 @@ +From adabdd8f6acabc0c3fdbba2e7f5a2edd9c5ef22d Mon Sep 17 00:00:00 2001 +From: katrinzhou +Date: Tue, 28 Jun 2022 11:50:30 +0800 +Subject: ipv6/sit: fix ipip6_tunnel_get_prl return value + +From: katrinzhou + +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 +Reviewed-by: Eric Dumazet +Reviewed-by: David Ahern +Link: https://lore.kernel.org/r/20220628035030.1039171-1-zys.zljxml@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/sit.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -314,8 +314,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) { +@@ -331,7 +329,7 @@ static int ipip6_tunnel_get_prl(struct i + } + } + +- c = 0; ++ rcu_read_lock(); + for_each_prl_rcu(t->prl) { + if (c >= cmax) + break; +@@ -343,7 +341,7 @@ static int ipip6_tunnel_get_prl(struct i + if (kprl.addr != htonl(INADDR_ANY)) + break; + } +-out: ++ + rcu_read_unlock(); + + len = sizeof(*kp) * c; +@@ -352,7 +350,7 @@ out: + ret = -EFAULT; + + kfree(kp); +- ++out: + return ret; + } + diff --git a/queue-4.19/series b/queue-4.19/series index 131d0854c89..9e8d24894fb 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -22,3 +22,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-4.19/sit-use-min.patch b/queue-4.19/sit-use-min.patch new file mode 100644 index 00000000000..ddf757fcf91 --- /dev/null +++ b/queue-4.19/sit-use-min.patch @@ -0,0 +1,34 @@ +From 284fda1eff8a8b27d2cafd7dc8fb423d13720f21 Mon Sep 17 00:00:00 2001 +From: kernel test robot +Date: Sat, 27 Mar 2021 10:29:32 +0100 +Subject: sit: use min + +From: kernel test robot + +commit 284fda1eff8a8b27d2cafd7dc8fb423d13720f21 upstream. + +Opportunity for min() + +Generated by: scripts/coccinelle/misc/minmax.cocci + +CC: Denis Efremov +Reported-by: kernel test robot +Signed-off-by: kernel test robot +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv6/sit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -316,7 +316,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 -- 2.47.3