]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Dec 2012 17:49:53 +0000 (12:49 -0500)
commita99c9e8eb9404bdfa0dd0b4172d8c1957eab9fe1
treedc56e7e2030cfd0fd0e8b876f86d18a08514a38c
parent82141d848cc4d026ea77b006b8d0d4b955e73c79
net: fix a race in gro_cell_poll()

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 9af545416a (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>
include/net/gro_cells.h