Re: [PATCH] 8139too: fix improper usage of workqueue
From: Francois Romieu <romieu@fr.zoreil.com>
Date: 2008-08-27 19:26:59
Stephen Hemminger [off-list ref] :
This driver was confused about how workqueue's work. It is save to schedule multiple times, and the flag (bitfield) was unnecessary and racy.
static void rtl8139_start_thread(struct rtl8139_private *tp)
{
tp->twistie = 0;
if (tp->chipset == CH_8139_K)
tp->twistie = 1;
else if (tp->drv_flags & HAS_LNK_CHNG)
return;
^^^^^^^
tp->have_thread = 1;
The use of the thread was dependent on RTL8129_CAPS. Now it will be
scheduled in the tx_timeout handler for RTL8139_CAPS too.
Speaking of race, the bitfield ('have_thread') is initialized through
rtl8139_open
-> rtl8139_start_thread
Do you mean that the tx_timeout handler can kick before the bitfield
is set ?
The workqueue was never canceled either, so it is possible that the thread could run after driver was removes [OOPS].
The driver uses flush_scheduled_work() when the pci device is removed. Where would the workqueue be scheduled after / during the removal ? -- Ueimor