]> git.karo-electronics.de Git - karo-tx-linux.git/commit
net: fix a race in gro_cell_poll()
authorEric Dumazet <edumazet@google.com>
Mon, 10 Dec 2012 12:32:03 +0000 (12:32 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Jan 2013 17:18:15 +0000 (09:18 -0800)
commite66e367bf75bb2e153f286a76592c2e23afc660d
tree8e6360bb60b8a7ed4ef8bd43f345a23f067b76e9
parentcc8605070a58f12b79c62f369a0446d89a7ca337
net: fix a race in gro_cell_poll()

[ Upstream commit f8e8f97c11d5ff3cc47d85b97c7c35e443dcf490 ]

Dmitry Kravkov reported packet drops for GRE packets since GRO support
was added.

There is a race in gro_cell_poll() because we call napi_complete()
without any synchronization with a concurrent gro_cells_receive()

Once bug was triggered, we queued packets but did not schedule NAPI
poll.

We can fix this issue using the spinlock protected the napi_skbs queue,
as we have to hold it to perform skb dequeue anyway.

As we open-code skb_dequeue(), we no longer need to mask IRQS, as both
producer and consumer run under BH context.

Bug added in commit c9e6bc644e (net: add gro_cells infrastructure)

Reported-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/gro_cells.h