tree fd85a89e3f3d10d7f604b45ae985ecbbc6f28fb6
parent c1a15468d58e75debc5437b2e4e12d02a89bb3a2
author Kai Makisara <[EMAIL PROTECTED]> Tue, 02 Aug 2005 12:21:51 +0300
committer James Bottomley <[EMAIL PROTECTED](none)> Tue, 02 Aug 2005 20:14:36 

[SCSI] Fix SCSI tape oops at module removal

Removing the SCSI tape module results in an oops in class_device_destroy if
any devices are present. The patch at the end of this message fixes the bug
by moving class_destroy() later in exit_st() so that the class still exists
when devices are removed. (The bug is old but class_simple_device_remove() did
nothing when the class did not exist.)

The patch also fixes a "class leak" in init_st() error path.

I would like to get this into 2.6.13 but it may be too late?

Signed-off-by: Kai Makisara <[EMAIL PROTECTED]>
Signed-off-by: James Bottomley <[EMAIL PROTECTED]>

 drivers/scsi/st.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4149,12 +4149,10 @@ static int __init init_st(void)
                        return 0;
-               if (st_sysfs_class)
-                       class_destroy(st_sysfs_class);
                unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
+       class_destroy(st_sysfs_class);
        printk(KERN_ERR "Unable to get major %d for SCSI tapes\n", 
        return 1;
@@ -4162,13 +4160,11 @@ static int __init init_st(void)
 static void __exit exit_st(void)
-       if (st_sysfs_class)
-               class_destroy(st_sysfs_class);
-       st_sysfs_class = NULL;
        unregister_chrdev_region(MKDEV(SCSI_TAPE_MAJOR, 0),
+       class_destroy(st_sysfs_class);
        printk(KERN_INFO "st: Unloaded.\n");
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to