All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH] sctp: verify length provided in heartbeat information parameter
Date: Fri, 30 Nov 2012 17:34:12 +0000	[thread overview]
Message-ID: <50B8EE14.7050804@gmail.com> (raw)
In-Reply-To: <20121130121627.GG30697@casper.infradead.org>

On 11/30/2012 07:16 AM, Thomas Graf wrote:
> If the variable parameter length provided in the mandatory
> heartbeat information parameter exceeds the calculated payload
> length the packet has been corrupted. Reply with a parameter
> length protocol violation message.
>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

> ---
>   net/sctp/sm_statefuns.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index b6adef8..e92079d 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -1055,6 +1055,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
>   				    void *arg,
>   				    sctp_cmd_seq_t *commands)
>   {
> +	sctp_paramhdr_t *param_hdr;
>   	struct sctp_chunk *chunk = arg;
>   	struct sctp_chunk *reply;
>   	size_t paylen = 0;
> @@ -1072,12 +1073,17 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
>   	 * Information field copied from the received HEARTBEAT chunk.
>   	 */
>   	chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
> +	param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr;
>   	paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
> +
> +	if (ntohs(param_hdr->length) > paylen)
> +		return sctp_sf_violation_paramlen(net, ep, asoc, type, arg,
> +						  param_hdr, commands);
> +
>   	if (!pskb_pull(chunk->skb, paylen))
>   		goto nomem;
>
> -	reply = sctp_make_heartbeat_ack(asoc, chunk,
> -					chunk->subh.hb_hdr, paylen);
> +	reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen);
>   	if (!reply)
>   		goto nomem;
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


WARNING: multiple messages have this Message-ID (diff)
From: Vlad Yasevich <vyasevich@gmail.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH] sctp: verify length provided in heartbeat information parameter
Date: Fri, 30 Nov 2012 12:34:12 -0500	[thread overview]
Message-ID: <50B8EE14.7050804@gmail.com> (raw)
In-Reply-To: <20121130121627.GG30697@casper.infradead.org>

On 11/30/2012 07:16 AM, Thomas Graf wrote:
> If the variable parameter length provided in the mandatory
> heartbeat information parameter exceeds the calculated payload
> length the packet has been corrupted. Reply with a parameter
> length protocol violation message.
>
> Signed-off-by: Thomas Graf <tgraf@suug.ch>

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

> ---
>   net/sctp/sm_statefuns.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
> index b6adef8..e92079d 100644
> --- a/net/sctp/sm_statefuns.c
> +++ b/net/sctp/sm_statefuns.c
> @@ -1055,6 +1055,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
>   				    void *arg,
>   				    sctp_cmd_seq_t *commands)
>   {
> +	sctp_paramhdr_t *param_hdr;
>   	struct sctp_chunk *chunk = arg;
>   	struct sctp_chunk *reply;
>   	size_t paylen = 0;
> @@ -1072,12 +1073,17 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net,
>   	 * Information field copied from the received HEARTBEAT chunk.
>   	 */
>   	chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
> +	param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr;
>   	paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
> +
> +	if (ntohs(param_hdr->length) > paylen)
> +		return sctp_sf_violation_paramlen(net, ep, asoc, type, arg,
> +						  param_hdr, commands);
> +
>   	if (!pskb_pull(chunk->skb, paylen))
>   		goto nomem;
>
> -	reply = sctp_make_heartbeat_ack(asoc, chunk,
> -					chunk->subh.hb_hdr, paylen);
> +	reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen);
>   	if (!reply)
>   		goto nomem;
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  parent reply	other threads:[~2012-11-30 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30 12:16 [PATCH] sctp: verify length provided in heartbeat information parameter Thomas Graf
2012-11-30 16:01 ` Neil Horman
2012-11-30 16:01   ` Neil Horman
2012-11-30 17:26   ` David Miller
2012-11-30 17:26     ` David Miller
2012-11-30 17:34 ` Vlad Yasevich [this message]
2012-11-30 17:34   ` Vlad Yasevich

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=50B8EE14.7050804@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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.