All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: linux-sctp@vger.kernel.org
Subject: Re: [PATCH] sctp: Add validity check for SCTP_PARTIAL_DELIVERY_POINT
Date: Mon, 01 Dec 2008 16:55:38 +0000	[thread overview]
Message-ID: <4934170A.3040401@hp.com> (raw)

Wei Yongjun wrote:
> The latest ietf socket extensions API draft said:
> 
>   8.1.21.  Set or Get the SCTP Partial Delivery Point
> 
>     Note also that the call will fail if the user attempts to set
>     this value larger than the socket receive buffer size.
> 
> This patch add this validity check for SCTP_PARTIAL_DELIVERY_POINT
> socket option.
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
> ---
>  net/sctp/socket.c |   16 +++++++++++++---
>  1 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 3a71475..336e9af 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -3010,14 +3010,21 @@ static int sctp_setsockopt_fragment_interleave(struct sock *sk,
>  }
>  
>  /*
> - * 7.1.25.  Set or Get the sctp partial delivery point
> + * 8.1.21.  Set or Get the SCTP Partial Delivery Point
>   *       (SCTP_PARTIAL_DELIVERY_POINT)
> + *
>   * This option will set or get the SCTP partial delivery point.  This
>   * point is the size of a message where the partial delivery API will be
>   * invoked to help free up rwnd space for the peer.  Setting this to a
> - * lower value will cause partial delivery's to happen more often.  The
> + * lower value will cause partial deliveries to happen more often.  The
>   * calls argument is an integer that sets or gets the partial delivery
> - * point.
> + * point.  Note also that the call will fail if the user attempts to set
> + * this value larger than the socket receive buffer size.
> + *
> + * Note that any single message having a length smaller than or equal to
> + * the SCTP partial delivery point will be delivered in one single read
> + * call as long as the user provided buffer is large enough to hold the
> + * message.
>   */
>  static int sctp_setsockopt_partial_delivery_point(struct sock *sk,
>  						  char __user *optval,
> @@ -3030,6 +3037,9 @@ static int sctp_setsockopt_partial_delivery_point(struct sock *sk,
>  	if (get_user(val, (int __user *)optval))
>  		return -EFAULT;
>  
> +	if (val > sk->sk_rcvbuf)
> +		return -EINVAL;

That should probably be (sk->sk_rcvbuf>>1) since we double the receive buffer
from what the user sets it to be.  Also, our initial rwnd is based on rcvbuf/2,
and we don't want to set the partial delivery ack point to be greater then
our full rwnd, since that would fill the window and the app will never receive
anything.


-vlad
> +
>  	sctp_sk(sk)->pd_point = val;
>  
>  	return 0; /* is this the right error code? */


             reply	other threads:[~2008-12-01 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-01 16:55 Vlad Yasevich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-11-27  2:33 [PATCH] sctp: Add validity check for SCTP_PARTIAL_DELIVERY_POINT Wei Yongjun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4934170A.3040401@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=linux-sctp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.