[LLC]: bogus llc packet length

discard llc packet which has bogus packet length.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Joonwoo Park 2008-03-28 16:27:33 -07:00 committed by David S. Miller
parent 2ba2506ca7
commit 27785d83e4

View file

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