Skip to content

Commit 27785d8

Browse files
joonwparkdavem330
authored andcommitted
[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>
1 parent 2ba2506 commit 27785d8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎net/llc/llc_input.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ static inline int llc_fixup_skb(struct sk_buff *skb)
117117
skb_pull(skb, llc_len);
118118
if (skb->protocol == htons(ETH_P_802_2)) {
119119
__be16 pdulen = eth_hdr(skb)->h_proto;
120-
u16 data_size = ntohs(pdulen) - llc_len;
120+
s32 data_size = ntohs(pdulen) - llc_len;
121121

122+
if (data_size < 0 ||
123+
((skb_tail_pointer(skb) -
124+
(u8 *)pdu) - llc_len) < data_size)
125+
return 0;
122126
if (unlikely(pskb_trim_rcsum(skb, data_size)))
123127
return 0;
124128
}

0 commit comments

Comments
 (0)