This is a note to let you know that I've just added the patch titled
[SCSI] fix duplicate removal on error path in
to the 2.6.33-longterm tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/longterm/longterm-queue-2.6.33.git;a=summary
The filename of the patch is:
fix-duplicate-removal-on-error-path-in.patch
and it can be found in the queue-2.6.33 subdirectory.
If you, or anyone else, feels it should not be added to the 2.6.33 longterm
tree,
please let <[email protected]> know about it.
>From ee37e09d81a4acf328f68189af12f116401f8c0f Mon Sep 17 00:00:00 2001
From: Alan Stern <[email protected]>
Date: Fri, 12 Feb 2010 12:13:55 -0500
Subject: [SCSI] fix duplicate removal on error path in
scsi_sysfs_add_sdev
From: Alan Stern <[email protected]>
commit ee37e09d81a4acf328f68189af12f116401f8c0f upstream.
This patch (as1335) fixes a bug in scsi_sysfs_add_sdev(). Its callers
always remove the device if anything goes wrong, so it should never
remove the device.
Signed-off-by: Alan Stern <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/scsi/scsi_sysfs.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -872,7 +872,8 @@ int scsi_sysfs_add_sdev(struct scsi_devi
struct request_queue *rq = sdev->request_queue;
struct scsi_target *starget = sdev->sdev_target;
- if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
+ error = scsi_device_set_state(sdev, SDEV_RUNNING);
+ if (error)
return error;
error = scsi_target_add(starget);
@@ -883,13 +884,13 @@ int scsi_sysfs_add_sdev(struct scsi_devi
error = device_add(&sdev->sdev_gendev);
if (error) {
printk(KERN_INFO "error 1\n");
- goto out_remove;
+ return error;
}
error = device_add(&sdev->sdev_dev);
if (error) {
printk(KERN_INFO "error 2\n");
device_del(&sdev->sdev_gendev);
- goto out_remove;
+ return error;
}
transport_add_device(&sdev->sdev_gendev);
sdev->is_visible = 1;
@@ -904,14 +905,14 @@ int scsi_sysfs_add_sdev(struct scsi_devi
else
error = device_create_file(&sdev->sdev_gendev,
&dev_attr_queue_depth);
if (error)
- goto out_remove;
+ return error;
if (sdev->host->hostt->change_queue_type)
error = device_create_file(&sdev->sdev_gendev,
&sdev_attr_queue_type_rw);
else
error = device_create_file(&sdev->sdev_gendev,
&dev_attr_queue_type);
if (error)
- goto out_remove;
+ return error;
error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL);
@@ -927,16 +928,11 @@ int scsi_sysfs_add_sdev(struct scsi_devi
error = device_create_file(&sdev->sdev_gendev,
sdev->host->hostt->sdev_attrs[i]);
if (error)
- goto out_remove;
+ return error;
}
}
- return 0;
-
- out_remove:
- __scsi_remove_device(sdev);
return error;
-
}
void __scsi_remove_device(struct scsi_device *sdev)
Patches currently in longterm-queue-2.6.33 which might be from
[email protected] are
_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable