bug in plip-driver [fix]

Egbert Eich (eich@hilbert.ikp.physik.tu-darmstadt.de)
Wed, 15 Dec 1999 13:29:50 +0100 (MET)


Appearantly there is no maintainer for the plip-driver
at the moment, so I send it here.

The fix below prevents kernel crashes if the last device
plip tries to initialize fails.
In this case dev_plip[i] (i == max_i) contains an invalid pointer.
cleanup_module() uses this pointer value to determine if
it should unregister and cleanup a dev_plip[] entry.
If the pointer is invalid the result will be catastrophic.

Regards,
Egbert.

This patch is agains 2.2.13 (however 2.3.31 exibits the same problem)

*** linux/drivers/net/plip.c.orig Sat Dec 11 23:22:38 1999
--- linux/drivers/net/plip.c Sat Dec 11 23:23:59 1999
***************
*** 1257,1262 ****
--- 1257,1263 ----
if (!dev_plip[i]->name) {
printk(KERN_ERR "plip: memory squeeze.\n");
kfree(dev_plip[i]);
+ dev_plip[i] = NULL;
break;
}
sprintf(dev_plip[i]->name, "plip%d", i);
***************
*** 1264,1269 ****
--- 1265,1271 ----
if (plip_init_dev(dev_plip[i],pb) || register_netdev(dev_plip[i])) {
kfree(dev_plip[i]->name);
kfree(dev_plip[i]);
+ dev_plip[i] = NULL;
} else {
i++;
}

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