Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a24484f281dda11e4fc0041a51907d3564da3d7f Commit: a24484f281dda11e4fc0041a51907d3564da3d7f Parent: d814c5173c671cf2c88d4e07db01b13312467ecd Author: FUJITA Tomonori <[EMAIL PROTECTED]> AuthorDate: Tue Jan 15 13:17:47 2008 +0900 Committer: James Bottomley <[EMAIL PROTECTED]> CommitDate: Wed Jan 23 11:29:28 2008 -0600
[SCSI] sg: set class_data after success If cdev_add fails in sg_add, sg_remove crashes since class_data is bogus. Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]> Acked-by: Douglas Gilbert <[EMAIL PROTECTED]> Signed-off-by: James Bottomley <[EMAIL PROTECTED]> --- drivers/scsi/sg.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index e65f5d4..ebbf9b4 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1422,7 +1422,6 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) goto out; } - class_set_devdata(cl_dev, sdp); error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, sdp->index), 1); if (error) goto cdev_add_err; @@ -1451,6 +1450,8 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) "Attached scsi generic sg%d type %d\n", sdp->index, scsidp->type); + class_set_devdata(cl_dev, sdp); + return 0; cdev_add_err: - 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 http://vger.kernel.org/majordomo-info.html