All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: joonwpark81@gmail.com
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] [LLC]: bogus llc packet length
Date: Mon, 24 Mar 2008 13:43:10 -0300	[thread overview]
Message-ID: <20080324164310.GD32612@ghostprotocols.net> (raw)
In-Reply-To: <47e7678b.1aba720a.6925.fffff466@mx.google.com>

Em Mon, Mar 24, 2008 at 05:34:16PM +0900, joonwpark81@gmail.com escreveu:
> From: Joonwoo Park <joonwpark81@gmail.com>
> 
> discard llc packet which has bogus packet length.
> 
> Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
> ---
> diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
> index c40c9b2..a2bbc7c 100644
> --- a/net/llc/llc_input.c
> +++ b/net/llc/llc_input.c
> @@ -117,8 +117,12 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
>  	skb_pull(skb, llc_len);
>  	if (skb->protocol == htons(ETH_P_802_2)) {
>  		__be16 pdulen = eth_hdr(skb)->h_proto;
> -		u16 data_size = ntohs(pdulen) - llc_len;
> +		s32 data_size = ntohs(pdulen) - llc_len;
>  
> +		if (data_size < 0
> +		    || ((skb_tail_pointer(skb) - (u8 *)pdu) - llc_len)
> +			< data_size)
> +			return 0;

Rewrite this as:

		if (data_size < 0 ||
		    ((skb_tail_pointer(skb) -
		      (u8 *)pdu) - llc_len) < data_size)

And stick my:

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

:-)

>  		if (unlikely(pskb_trim_rcsum(skb, data_size)))
>  			return 0;
>  	}
> -- 
> 1.5.4.3
> 
> --
> 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

       reply	other threads:[~2008-03-24 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <47e7678b.1aba720a.6925.fffff466@mx.google.com>
2008-03-24 16:43 ` Arnaldo Carvalho de Melo [this message]
2008-03-25  5:16   ` [PATCH 2/3] [LLC]: bogus llc packet length Joonwoo Park
2008-03-28  7:59 Joonwoo Park
2008-03-28 13:13 ` Arnaldo Carvalho de Melo
2008-03-28 23:27   ` David Miller

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=20080324164310.GD32612@ghostprotocols.net \
    --to=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=joonwpark81@gmail.com \
    --cc=netdev@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.