Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;