summaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-08 03:21:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-08 03:21:38 +0000
commit9351405e44641037ccff29c0d88d92c0617b5088 (patch)
treedfee90e28394ae31df1033696f8656add6c4fc26 /net/ipv6/sit.c
parentReleasing progress-linux version 4.19.249-2progress5u1. (diff)
downloadlinux-9351405e44641037ccff29c0d88d92c0617b5088.tar.xz
linux-9351405e44641037ccff29c0d88d92c0617b5088.zip
Merging upstream version 4.19.260.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'net/ipv6/sit.c')
-rw-r--r--net/ipv6/sit.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 55c999cbe..420b9fcc1 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -314,9 +314,7 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t,
kcalloc(cmax, sizeof(*kp), GFP_KERNEL | __GFP_NOWARN) :
NULL;
- 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
@@ -331,7 +329,7 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t,
}
}
- 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 ip_tunnel *t,
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;
}