kernel-ark/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 Staging: agnx: fix build warnings 2009-06-19 11:00:35 -07:00
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 net: fix network drivers ndo_start_xmit() return values (part 8) 2009-06-13 01:18:45 -07:00
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 Staging: DST: fix build dependancy 2009-04-03 14:53:33 -07:00
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 net: use symbolic values for ndo_start_xmit() return codes 2009-06-13 01:18:50 -07:00
frontier Staging: remove unused #include <linux/version.h>'s 2009-06-19 11:00:36 -07:00
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 Staging: line6: convert to snd_card_create() 2009-04-17 11:06:25 -07:00
me4000 Staging: me4000: make file_operations const 2009-04-03 14:53:25 -07:00
meilhaus Staging: remove unused #include <linux/version.h>'s 2009-06-19 11:00:36 -07:00
mimio Staging: mimio: depends on INPUT 2009-04-03 14:53:29 -07:00
octeon Staging: octeon-ethernet: Fix race freeing transmit buffers. 2009-06-24 18:34:41 +01:00
otus Staging: otus: beyond ARRAY_SIZE of wd->ap.wds.encryMode 2009-06-19 11:00:37 -07:00
p9auth staging: p9auth: prevent some oopses and memory leaks 2009-06-19 11:00:54 -07:00
panel trivial: Miscellaneous documentation typo fixes 2009-06-12 18:01:47 +02:00
pata_rdc Staging: pata_rdc: remove pointless comments 2009-06-19 11:00:57 -07:00
phison Staging: phison: depends on PCI 2009-04-03 14:53:40 -07:00
poch Staging: poch: fix verification of memory area 2009-01-28 15:49:06 -08:00
pohmelfs Staging: pohmelfs: Storage class should be before const qualifier 2009-06-19 11:00:39 -07:00
rspiusb Staging: rspiusb: copy_to/from_user related fixes 2009-06-19 11:00:54 -07:00
rt2860 staging: rtlxxxx: off by one in AsicSendCommandToMcu() and NDIS_STATUS NICLoadFirmware() 2009-06-19 11:00:51 -07:00
rt2870 Staging: rt2870: fix build warnings 2009-06-19 11:00:51 -07:00
rt3070 Staging: rt{28,30}70: merge rt{28,30}70/sta/*.[ch] 2009-06-19 11:00:50 -07:00
rtl8187se Staging: rtl8187se: wmm_param[1].ac_aci_acm_aifsn tested twice 2009-06-19 11:00:36 -07:00
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 Staging: stlc45xx: replace print_mac with %pM 2009-06-19 11:00:36 -07:00
sxg Staging: sxg: Add missing __devexit_p() 2009-06-19 11:00:35 -07:00
uc2322 USB: usb-serial: replace shutdown with disconnect, release 2009-06-15 21:44:47 -07:00
udlfb Staging: udlfb: update to version 0.2.3 2009-06-19 11:00:57 -07:00
usbip Staging: BUG to BUG_ON changes 2009-04-03 14:54:26 -07:00
vt6655 Staging: vt6655: uses pci functions, should depend on PCI 2009-06-19 11:00:52 -07:00
winbond Staging: winbond: mac80211 - unify config_interface and bss_info_changed 2009-06-19 11:00:38 -07:00
wlan-ng Staging: wlan-ng: Update README file. Remove Lindent task 2009-06-19 11:00:39 -07:00
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 Staging: workaround build system bug 2008-10-13 14:32:52 -07:00