Re: linux-kernel-digest V1 #2779

Maxim Krasnyansky (max@viper.uznet.net)
Tue, 3 Nov 1998 18:07:24 -0500 (GMT+5)


Hi !

I am sorry if it was already disscussed.
When writing tty driver for the new short range modem card I've found
problems with run_task_queue. On highly loaded systems when
queue_task_irq_off get called very frequetly it is possible to damage
tqueue list because run_task_queue is not interrupt safe, it calls from
do_bottom_half with interrupts on and modifies important pointers without
disabling interrupts.

Patch folows.
--------------------------

--- linux-2.0.35.orig/include/linux/tqueue.h Fri Mar 28 19:08:16 1997
+++ linux-2.0.35/include/linux/tqueue.h Tue Nov 3 17:38:46 1998
@@ -7,6 +7,9 @@
* Modified for use in the Linux kernel by Theodore Ts'o,
* tytso@mit.edu. Any bugs are my fault, not Kai's.
*
+ * Modified run_task_queue to be interrupt safe
+ * Maxim Krasnyansky <max@uznet.net>.
+ *
* The original comment follows below.
*/

@@ -121,6 +124,9 @@

/*
* Call all "bottom halfs" on a given list.
+ *
+ * It calls with interrupts on, so it must be interrupt safe.
+ *
*/
extern __inline__ void run_task_queue(task_queue *list)
{
@@ -131,11 +137,13 @@
void *arg;
void (*f) (void *);
struct tq_struct *save_p;
+ cli();
arg = p -> data;
f = p -> routine;
save_p = p;
p = p -> next;
save_p -> sync = 0;
+ sti();
(*f)(arg);
}
}

Maxim Krasnyansky System and Network administrator
UzNet ISP Unix system programmer
max@uznet.net +7(99871)139-83-04
max@viper.uznet.net +7(99871)180-01-07

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/