[PATCH] floppy driver oopses on forced unload (against 2.5.65)

From: Angus Sawyer (angus.sawyer@dsl.pipex.com)
Date: Wed Mar 19 2003 - 17:11:35 EST


Prevent OOPS on removing floppy driver with "rmmod -f floppy".

floppy.c would attempt to unregister resources for nonexistent device.

Patch stops the driver attempting to register and unregister the nonexistent
device by removing the drive from the allowed drives mask (defaults to
present).

 drivers/block/floppy.c | 2 ++
 1 files changed, 2 insertions(+)

diff -puN drivers/block/floppy.c~floppy-unload-fix drivers/block/floppy.c
--- linux-2.5.65/drivers/block/floppy.c~floppy-unload-fix Wed Mar 19 18:44:15
2003
+++ linux-2.5.65-/drivers/block/floppy.c Wed Mar 19 21:33:22 2003
@@ -3649,6 +3649,8 @@ static void __init config_types(void)
                                 name = default_drive_params[type].name;
                                 allowed_drive_mask |= 1 << drive;
                         }
+ else
+ allowed_drive_mask &= ~(1 << drive);
                 } else {
                         params = &default_drive_params[0].params;
                         sprintf(temparea, "unknown type %d (usb?)", type);

_

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



This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:28 EST