summaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-02-28 15:17:27 -0800
committerDavid S. Miller <davem@davemloft.net>2019-03-01 23:08:30 -0800
commit6bdef102dae9d24d8eafc9ddfd2bf94a67be3bdc (patch)
tree9daaaed512a76cc3f80045d97e6fce11986b27e5 /net/core/sock.c
parent255c1c7279abf991113e7c9c29f91e9f1a5776a9 (diff)
downloadlinux-6bdef102dae9d24d8eafc9ddfd2bf94a67be3bdc.tar.gz
linux-6bdef102dae9d24d8eafc9ddfd2bf94a67be3bdc.tar.bz2
linux-6bdef102dae9d24d8eafc9ddfd2bf94a67be3bdc.zip
net: support 64bit values for setsockopt(SO_MAX_PACING_RATE)
64bit kernels now support 64bit pacing rates. This commit changes setsockopt() to accept 64bit values provided by applications. Old applications providing 32bit value are still supported, but limited to the old 34Gbit limitation. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index f5d82f3fa474..23aa02ffd6b8 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1108,15 +1108,23 @@ set_rcvbuf:
#endif
case SO_MAX_PACING_RATE:
- if (val != ~0U)
+ {
+ unsigned long ulval = (val == ~0U) ? ~0UL : val;
+
+ if (sizeof(ulval) != sizeof(val) &&
+ optlen >= sizeof(ulval) &&
+ get_user(ulval, (unsigned long __user *)optval)) {
+ ret = -EFAULT;
+ break;
+ }
+ if (ulval != ~0UL)
cmpxchg(&sk->sk_pacing_status,
SK_PACING_NONE,
SK_PACING_NEEDED);
- sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val;
- sk->sk_pacing_rate = min(sk->sk_pacing_rate,
- sk->sk_max_pacing_rate);
+ sk->sk_max_pacing_rate = ulval;
+ sk->sk_pacing_rate = min(sk->sk_pacing_rate, ulval);
break;
-
+ }
case SO_INCOMING_CPU:
sk->sk_incoming_cpu = val;
break;