diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-08-26 06:26:15 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-26 16:49:04 (GMT) |
commit | e9278a475f845833b569ca47171e64fe48c616e0 (patch) | |
tree | dfc4fbbb8bcbcd0fee9c67d17a8c3366f4094959 /net/core/netpoll.c | |
parent | 3d015565f316584139946a1c450d44209beefeb6 (diff) | |
download | linux-e9278a475f845833b569ca47171e64fe48c616e0.tar.xz |
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: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r-- | net/core/netpoll.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index adf84dd..5262251 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -558,13 +558,14 @@ int __netpoll_rx(struct sk_buff *skb) if (skb_shared(skb)) goto out; - iph = (struct iphdr *)skb->data; if (!pskb_may_pull(skb, sizeof(struct iphdr))) goto out; + iph = (struct iphdr *)skb->data; if (iph->ihl < 5 || iph->version != 4) goto out; if (!pskb_may_pull(skb, iph->ihl*4)) goto out; + iph = (struct iphdr *)skb->data; if (ip_fast_csum((u8 *)iph, iph->ihl) != 0) goto out; @@ -579,6 +580,7 @@ int __netpoll_rx(struct sk_buff *skb) if (pskb_trim_rcsum(skb, len)) goto out; + iph = (struct iphdr *)skb->data; if (iph->protocol != IPPROTO_UDP) goto out; |