Re: [WATCHDOG] v2.6.13 watchdog-patches

From: Bill Davidsen
Date: Mon Sep 12 2005 - 12:24:12 EST


Arjan van de Ven wrote:
On Sat, 2005-09-03 at 22:04 +0200, Wim Van Sebroeck wrote:

Author: Chuck Ebbert <76306.1226@xxxxxxxxxxxxxx>
Date: Fri Aug 19 14:14:07 2005 +0200

[WATCHDOG] softdog-timer-running-oops.patch
The softdog watchdog timer has a bug that can create an oops:
1. Load the module without the nowayout option.
2. Open the driver and close it without writing 'V' before close.
3. Unload the module. The timer will continue to run...
4. Oops happens when timer fires.
Reported Sun, 10 Oct 2004, by Michael Schierl <schierlm@xxxxxx>
Fix is easy: always take a reference on the module on open.
Release it only when the device is closed and no timer is running.
Tested on 2.6.13-rc6 using the soft_noboot option. While the
timer is running and the device is closed, the module use count
stays at 1. After the timer fires, it drops to 0. Repeatedly
opening and closing the driver caused no problems. Please apply.



this looks ENTIRELY like the wrong solution!
Isn't it a LOT easier to just del_timer_sync() the timer from the module
exit code? Mucking with module refcounts in a driver is almost always a
sign of a bug or at least really bad design, and I think that is the
case here.....
Perhaps you misunderstood the problem. The problem is that the timer module can be unloaded with a timer running. The solution is not to silently stop the timer and allow the module to be unloaded, having a timer running is, in a sense, a ref, and the ref count can and should reflect that.

If the admin wants to stop the timer there are tools to do that now, then the module can be removed.

I'm generally against the Windows approach of "do you really want to do that?" paranoia about letting the user do certain things, but locking in the module if I have started a timer sounds like a good safety precaution.

--
-bill davidsen (davidsen@xxxxxxx)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/