[PATCH] CRITICAL bug(s?) in parport driver

From: Paul Barton-Davis (pbd@op.net)
Date: Wed Jul 19 2000 - 10:58:16 EST


There is a critical bug in the parport driver that prevents it from
ever attaching any device driver to any ports under some (all?)
circumstances. Patch enclosed.

HOWEVER: from a casual inspection of the code, there are several other
locations where the use of loop increment variables seems odd. I have
not chosen to dabble with these, but here is the most obvious example,
from attach_driver_chain():

------------------------------------------------------------------------------
        spin_lock (&driverlist_lock);
        for (i = 0, drv = driver_chain; drv && i < count; drv = drv->next)
                attach[i] = drv->attach;
        spin_unlock (&driverlist_lock);

   ..... So whats the value of `i' now, and what does it mean ???? ....

        for (count = 0; count < i; count++)
                (*attach[i]) (port);
------------------------------------------------------------------------------

Anyway, here is the patch that was stopping my printer (and as far as
I can tell, *any* parport driver) from working, at least when compiled
into the kernel.

--p

--- linux/drivers/parport/share.c.orig Wed Jul 12 19:24:34 2000
+++ linux/drivers/parport/share.c Wed Jul 19 11:52:14 2000
@@ -200,7 +200,7 @@
        else {
                spin_lock (&parportlist_lock);
                for (i = 0, port = portlist; port && i < count;
- port = port->next)
+ port = port->next, i++)
                        ports[i] = port;
                spin_unlock (&parportlist_lock);

-
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/



This archive was generated by hypermail 2b29 : Sun Jul 23 2000 - 21:00:12 EST