Skip to content

Commit

Permalink
net: sched: ife: check on metadata length
Browse files Browse the repository at this point in the history
This patch checks if sk buffer is available to dererence ife header. If
not then NULL will returned to signal an malformed ife packet. This
avoids to crashing the kernel from outside.

Signed-off-by: Alexander Aring <[email protected]>
Reviewed-by: Yotam Gigi <[email protected]>
Acked-by: Jamal Hadi Salim <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexander Aring authored and davem330 committed Apr 23, 2018
1 parent cc74edd commit d57493d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ife/ife.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ void *ife_decode(struct sk_buff *skb, u16 *metalen)
int total_pull;
u16 ifehdrln;

if (!pskb_may_pull(skb, skb->dev->hard_header_len + IFE_METAHDRLEN))
return NULL;

ifehdr = (struct ifeheadr *) (skb->data + skb->dev->hard_header_len);
ifehdrln = ntohs(ifehdr->metalen);
total_pull = skb->dev->hard_header_len + ifehdrln;
Expand Down

0 comments on commit d57493d

Please sign in to comment.