linux/drivers/staging
David Daney a620c16326 Staging: octeon-ethernet: Fix race freeing transmit buffers.
The existing code had the following race:

Thread-1                       Thread-2

inc/read in_use
                               inc/read in_use
inc tx_free_list[qos].len
                               inc tx_free_list[qos].len

The actual in_use value was incremented twice, but thread-1 is going
to free memory based on its stale value, and will free one too many
times.  The result is that memory is freed back to the kernel while
its packet is still in the transmit buffer.  If the memory is
overwritten before it is transmitted, the hardware will put a valid
checksum on it and send it out (just like it does with good packets).
If by chance the TCP flags are clobbered but not the addresses or
ports, the result can be a broken TCP stream.

The fix is to track the number of freed packets in a single location
(a Fetch-and-Add Unit register).  That way it can never get out of sync
with itself.

We try to free up to MAX_SKB_TO_FREE (currently 10) buffers at a time.
If fewer are available we adjust the free count with the difference.
The action of claiming buffers to free is atomic so two threads cannot
claim the same buffers.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-06-24 18:34:41 +01:00
..
agnx
altpciechdma Staging: altpciechdma: fix build warnings 2009-06-19 11:00:55 -07:00
android Staging: android: fix Kconfig issues 2009-06-19 11:00:52 -07:00
asus_oled Staging: asus_oled: fix build warnings 2009-06-19 11:00:55 -07:00
at76_usb
b3dfg staging: b3dfg: clean up MODULE_PARM_DESC newline 2009-06-19 11:00:54 -07:00
comedi Staging: comedi: fix build errors 2009-06-19 11:04:32 -07:00
cpc-usb Staging: cpc-usb: fix build warnings 2009-06-19 11:00:53 -07:00
dst
echo Staging: oslec bug fix 2009-06-19 11:00:54 -07:00
epl Staging: epl: do not use CLONE_SIGHAND with allow_signal() 2009-06-19 11:00:52 -07:00
et131x
frontier
go7007 staging: wis-sony-tuner.c: fix &&/|| error 2009-06-19 11:00:54 -07:00
heci Staging: heci: fix the problem that file_ext->state should be protected by device_lock 2009-06-19 11:00:55 -07:00
line6
me4000
meilhaus
mimio
octeon Staging: octeon-ethernet: Fix race freeing transmit buffers. 2009-06-24 18:34:41 +01:00
otus
p9auth staging: p9auth: prevent some oopses and memory leaks 2009-06-19 11:00:54 -07:00
panel
pata_rdc Staging: pata_rdc: remove pointless comments 2009-06-19 11:00:57 -07:00
phison
poch
pohmelfs
rspiusb Staging: rspiusb: copy_to/from_user related fixes 2009-06-19 11:00:54 -07:00
rt2860
rt2870
rt3070
rtl8187se
rtl8192su Staging: rtl8192su: Correct use of ! and & 2009-06-19 11:00:54 -07:00
serqt_usb2 tty: fix some bogns in the serqt_usb2 driver 2009-06-22 11:32:24 -07:00
slicoss Staging: slicoss: fix build warnings 2009-06-19 11:00:55 -07:00
stlc45xx
sxg
uc2322
udlfb Staging: udlfb: update to version 0.2.3 2009-06-19 11:00:57 -07:00
usbip
vt6655
winbond
wlan-ng
Kconfig Staging: udlfb: add udlfb driver to build 2009-06-19 11:00:57 -07:00
Makefile Staging: udlfb: add udlfb driver to build 2009-06-19 11:00:57 -07:00
staging.c