* [PATCH] 2.5.34 floppy driver init/exit fixes
@ 2002-09-10 15:04 Mikael Pettersson
0 siblings, 0 replies; only message in thread
From: Mikael Pettersson @ 2002-09-10 15:04 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
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
diff -ruN linux-2.5.34/drivers/block/floppy.c linux-2.5.34.floppy/drivers/block/floppy.c
--- linux-2.5.34/drivers/block/floppy.c Mon Sep 9 21:15:28 2002
+++ linux-2.5.34.floppy/drivers/block/floppy.c Mon Sep 9 21:20:51 2002
@@ -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");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-09-10 15:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-10 15:04 [PATCH] 2.5.34 floppy driver init/exit fixes Mikael Pettersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).