PATCH: linux-2.4.10-pre14/drviers/net/irda/toshoboe.c module segfaults at removal if hardware absent

Adam J. Richter (adam@yggdrasil.com)
Sat, 22 Sep 2001 23:29:16 -0700


--k+w/mQv8wyuph6w0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

linux-2.4.10-pre14/drivers/net/irda/toshoboe.c
ignored the return value from pci_module_init() at module
load time, and then unconditionally calls pci_unregister_module
when the module is unloaded (even if the driver is not registered,
due to pci_module_init failing). I have verified that this results
in a kernel null pointer dereference if you load and unload this
module on a system lacking the toshboe hardware.

The following trivial patch fixes the problem by aborting
the module initialization if pci_module_init fails.

Please apply.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

--k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="tosh.diff"

949,950c949 < pci_module_init(&toshoboe_pci_driver); < return 0;

---
>   return pci_module_init(&toshoboe_pci_driver);

--k+w/mQv8wyuph6w0-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/