2.5.34 floppy driver init/exit fixes
Subsystems (2)
PATCH 1/1 2.5.34 floppy driver init/exit fixes
The 2.5 floppy driver has for a long time has two init/exit bugs:
1. It calls register_sys_device() on init, but fails to call unregister_sys_device() in exit. This leads to data structure corruption if floppy is a module and it gets unloaded.
2. If calls register_sys_device() early on init, but fails to call unregister_sys_device() if init fails. Again, this leads to data structure corruption.
The patch below fixes both these problems. I've used it since 2.5.13 or so. Please apply.
/Mikael
drivers/block/floppy.c +4 -2
@@ -4219,8 +4219,6 @@ {int i,unit,drive; -register_sys_device (&device_floppy); - raw_cmd =NULL ; devfs_handle =devfs_mk_dir (NULL ,"floppy" ,NULL );
@@ -4347,6 +4345,9 @@register_disk (NULL ,mk_kdev (MAJOR_NR ,TOMINOR (drive)+i*4 ),1 , &floppy_fops,0 ); } + +register_sys_device (&device_floppy); +return have_no_fdc; }
@@ -4529,6 +4530,7 @@ {int dummy; +unregister_sys_device (&device_floppy);devfs_unregister (devfs_handle);unregister_blkdev (MAJOR_NR ,"fd" );