Commit e9278a47 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

netpoll: fix incorrect access to skb data in __netpoll_rx

__netpoll_rx() doesnt properly handle skbs with small header

pskb_may_pull() or pskb_trim_rcsum() can change skb->data, we must
reload it.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d015565
...@@ -558,13 +558,14 @@ int __netpoll_rx(struct sk_buff *skb) ...@@ -558,13 +558,14 @@ int __netpoll_rx(struct sk_buff *skb)
if (skb_shared(skb)) if (skb_shared(skb))
goto out; goto out;
iph = (struct iphdr *)skb->data;
if (!pskb_may_pull(skb, sizeof(struct iphdr))) if (!pskb_may_pull(skb, sizeof(struct iphdr)))
goto out; goto out;
iph = (struct iphdr *)skb->data;
if (iph->ihl < 5 || iph->version != 4) if (iph->ihl < 5 || iph->version != 4)
goto out; goto out;
if (!pskb_may_pull(skb, iph->ihl*4)) if (!pskb_may_pull(skb, iph->ihl*4))
goto out; goto out;
iph = (struct iphdr *)skb->data;
if (ip_fast_csum((u8 *)iph, iph->ihl) != 0) if (ip_fast_csum((u8 *)iph, iph->ihl) != 0)
goto out; goto out;
...@@ -579,6 +580,7 @@ int __netpoll_rx(struct sk_buff *skb) ...@@ -579,6 +580,7 @@ int __netpoll_rx(struct sk_buff *skb)
if (pskb_trim_rcsum(skb, len)) if (pskb_trim_rcsum(skb, len))
goto out; goto out;
iph = (struct iphdr *)skb->data;
if (iph->protocol != IPPROTO_UDP) if (iph->protocol != IPPROTO_UDP)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment