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>
This commit is contained in:
Родитель
3d015565f3
Коммит
e9278a475f
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче