From: Alan Stern Date: Fri, 12 Feb 2010 17:13:39 +0000 (-0500) Subject: fix refcounting bug in scsi_get_host_dev X-Git-Tag: v2.6.32.42~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e3a40450613ba9d77c4f0bad6c27bdbd8891187;p=thirdparty%2Fkernel%2Fstable.git fix refcounting bug in scsi_get_host_dev commit d5469119f0098881ab7f991990ef4f81ef13a194 upstream. This patch (as1334) fixes a bug in scsi_get_host_dev(). It incorrectly calls get_device() on the new device's target. Signed-off-by: Alan Stern Signed-off-by: James Bottomley Cc: Hannes Reinecke Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 14d2703815907..ed1dfa9174520 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1906,10 +1906,9 @@ struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost) goto out; sdev = scsi_alloc_sdev(starget, 0, NULL); - if (sdev) { - sdev->sdev_gendev.parent = get_device(&starget->dev); + if (sdev) sdev->borken = 0; - } else + else scsi_target_reap(starget); put_device(&starget->dev); out: