summaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorEric Dumazet2012-12-06 14:54:59 +0100
committerDavid S. Miller2012-12-07 20:39:29 +0100
commitc3c7c254b2e8cd99b0adf288c2a1bddacd7ba255 (patch)
treecca25bcae0cc6172a616335041c1e54a33db451c /net/core/dev.c
parenttcp: bug fix Fast Open client retransmission (diff)
downloadkernel-qcow2-linux-c3c7c254b2e8cd99b0adf288c2a1bddacd7ba255.tar.gz
kernel-qcow2-linux-c3c7c254b2e8cd99b0adf288c2a1bddacd7ba255.tar.xz
kernel-qcow2-linux-c3c7c254b2e8cd99b0adf288c2a1bddacd7ba255.zip
net: gro: fix possible panic in skb_gro_receive()
commit 2e71a6f8084e (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>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index c0946cb2b354..e5942bf45a6d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3451,6 +3451,8 @@ static int napi_gro_complete(struct sk_buff *skb)
struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK];
int err = -ENOENT;
+ BUILD_BUG_ON(sizeof(struct napi_gro_cb) > sizeof(skb->cb));
+
if (NAPI_GRO_CB(skb)->count == 1) {
skb_shinfo(skb)->gso_size = 0;
goto out;