net: gro: fix possible panic in skb_gro_receive()
commit 2e71a6f808
(net: gro: selective flush of packets) added
a bug for skbs using frag_list. This part of the GRO stack is rarely
used, as it needs skb not using a page fragment for their skb->head.
Most drivers do use a page fragment, but some of them use GFP_KERNEL
allocations for the initial fill of their RX ring buffer.
napi_gro_flush() overwrite skb->prev that was used for these skb to
point to the last skb in frag_list.
Fix this using a separate field in struct napi_gro_cb to point to the
last fragment.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
93b174ad71
commit
c3c7c254b2
@@ -3004,7 +3004,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
|
||||
skb_shinfo(nskb)->gso_size = pinfo->gso_size;
|
||||
pinfo->gso_size = 0;
|
||||
skb_header_release(p);
|
||||
nskb->prev = p;
|
||||
NAPI_GRO_CB(nskb)->last = p;
|
||||
|
||||
nskb->data_len += p->len;
|
||||
nskb->truesize += p->truesize;
|
||||
@@ -3030,8 +3030,8 @@ merge:
|
||||
|
||||
__skb_pull(skb, offset);
|
||||
|
||||
p->prev->next = skb;
|
||||
p->prev = skb;
|
||||
NAPI_GRO_CB(p)->last->next = skb;
|
||||
NAPI_GRO_CB(p)->last = skb;
|
||||
skb_header_release(skb);
|
||||
|
||||
done:
|
||||
|
Reference in New Issue
Block a user