[PATCH] Fix kernel lockup in RTL-8169 gigabit ethernet driver

Adam Nielsen
2004-04-03T04:59:22Z

Hi everyone,

This is a tiny patch that fixes a particularly annoying bug
in the Realtek 8169 gigabit ethernet driver. Due to a logic error,
there is a loop in an interrupt handler that often goes infinite, thus
locking up the entire computer. The attached patch fixes the problem.

I have patched against linux-2.6.5-rc2-bk6, however the source file in
question hasn't been modified for a long time, so the patch should apply
cleanly to any recent kernel version.

Cheers,
Adam.

--- linux-2.6.5-rc2-bk6/drivers/net/r8169.c 2004-03-27 17:38:03.000000000 +1000
+++ linux-2.6.5-rc2-bk6a/drivers/net/r8169.c 2004-03-31 18:45:10.000000000 +1000
@@ -33,6 +33,12 @@
- Copy mc_filter setup code from 8139cp
(includes an optimization, and avoids set_bit use)

+VERSION 1.2a <2004/03/31> Adam Nielsen (a.nielsen@optushome.com.au)
+
+ "else break;" added to the if-statement in rtl8169_tx_interrupt() to prevent
+ an infinite loop and the resulting kernel lockup when the interrupt is called
+ with a dirty buffer (perhaps when there's nothing to transmit?)
+
*/

#include <linux/module.h>
@@ -892,7 +898,7 @@
tp->Tx_skbuff[entry] = NULL;
dirty_tx++;
tx_left--;
- }
+ } else break;
}

if (tp->dirty_tx != dirty_tx) {