1
0
Fork 0
alistair23-linux/drivers/net/can
Ahmed S. Darwish a9dc960c37 can: kvaser_usb: Fix tx queue start/stop race conditions
A number of tx queue wake-up events went missing due to the
outlined scenario below. Start state is a pool of 16 tx URBs,
active tx_urbs count = 15, with the netdev tx queue open.

CPU #1 [softirq]                         CPU #2 [softirq]
start_xmit()                             tx_acknowledge()
................                         ................

atomic_inc(&tx_urbs);
if (atomic_read(&tx_urbs) >= 16) {
                        -->
                                         atomic_dec(&tx_urbs);
                                         netif_wake_queue();
                                         return;
                        <--
    netif_stop_queue();
}

At the end, the correct state expected is a 15 tx_urbs count
value with the tx queue state _open_. Due to the race, we get
the same tx_urbs value but with the tx queue state _stopped_.
The wake-up event is completely lost.

Thus avoid hand-rolled concurrency mechanisms and use a proper
lock for contexts and tx queue protection.

Signed-off-by: Ahmed S. Darwish <ahmed.darwish@valeo.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-03-14 09:20:07 +01:00
..
c_can Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-01-27 16:59:56 -08:00
cc770 can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
m_can Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-01-27 16:59:56 -08:00
mscan Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
sja1000 Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
softing can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
spi can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
usb can: kvaser_usb: Fix tx queue start/stop race conditions 2015-03-14 09:20:07 +01:00
Kconfig net: can: Enable xilinx driver for ARM64 2015-03-14 09:01:16 +01:00
Makefile can: Enable -D__CHECK_ENDIAN__ for sparse by default 2014-12-07 21:22:06 +01:00
at91_can.c can: at91_can: remove unused variable 2015-01-21 22:47:44 +01:00
bfin_can.c can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
dev.c can: add missing initialisations in CAN related skbuffs 2015-03-09 10:22:24 +01:00
flexcan.c can: flexcan: remove unused variable 2015-01-21 22:47:44 +01:00
grcan.c net: can: drop owner assignment from platform_drivers 2014-10-20 16:20:59 +02:00
janz-ican3.c can: janz-ican3: fix type mismatch in assignment 2015-02-04 14:06:43 +01:00
led.c can: only rename enabled led triggers when changing the netdev name 2014-05-27 15:05:41 +02:00
pch_can.c can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
rcar_can.c can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
slcan.c can: slcan/vcan: eliminate banner[] variable, switch to pr_info() 2014-12-07 21:22:05 +01:00
ti_hecc.c can: move can_stats.bus_off++ from can_bus_off into can_change_state 2015-01-20 13:56:53 +01:00
vcan.c can: slcan/vcan: eliminate banner[] variable, switch to pr_info() 2014-12-07 21:22:05 +01:00
xilinx_can.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00