aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/socket.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9f5fe23773a9..b14a8f33e42d 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3010,14 +3010,21 @@ static int sctp_setsockopt_fragment_interleave(struct sock *sk,
3010} 3010}
3011 3011
3012/* 3012/*
3013 * 7.1.25. Set or Get the sctp partial delivery point 3013 * 8.1.21. Set or Get the SCTP Partial Delivery Point
3014 * (SCTP_PARTIAL_DELIVERY_POINT) 3014 * (SCTP_PARTIAL_DELIVERY_POINT)
3015 *
3015 * This option will set or get the SCTP partial delivery point. This 3016 * This option will set or get the SCTP partial delivery point. This
3016 * point is the size of a message where the partial delivery API will be 3017 * point is the size of a message where the partial delivery API will be
3017 * invoked to help free up rwnd space for the peer. Setting this to a 3018 * invoked to help free up rwnd space for the peer. Setting this to a
3018 * lower value will cause partial delivery's to happen more often. The 3019 * lower value will cause partial deliveries to happen more often. The
3019 * calls argument is an integer that sets or gets the partial delivery 3020 * calls argument is an integer that sets or gets the partial delivery
3020 * point. 3021 * point. Note also that the call will fail if the user attempts to set
3022 * this value larger than the socket receive buffer size.
3023 *
3024 * Note that any single message having a length smaller than or equal to
3025 * the SCTP partial delivery point will be delivered in one single read
3026 * call as long as the user provided buffer is large enough to hold the
3027 * message.
3021 */ 3028 */
3022static int sctp_setsockopt_partial_delivery_point(struct sock *sk, 3029static int sctp_setsockopt_partial_delivery_point(struct sock *sk,
3023 char __user *optval, 3030 char __user *optval,
@@ -3030,6 +3037,12 @@ static int sctp_setsockopt_partial_delivery_point(struct sock *sk,
3030 if (get_user(val, (int __user *)optval)) 3037 if (get_user(val, (int __user *)optval))
3031 return -EFAULT; 3038 return -EFAULT;
3032 3039
3040 /* Note: We double the receive buffer from what the user sets
3041 * it to be, also initial rwnd is based on rcvbuf/2.
3042 */
3043 if (val > (sk->sk_rcvbuf >> 1))
3044 return -EINVAL;
3045
3033 sctp_sk(sk)->pd_point = val; 3046 sctp_sk(sk)->pd_point = val;
3034 3047
3035 return 0; /* is this the right error code? */ 3048 return 0; /* is this the right error code? */