Skip to content

Commit

Permalink
[SCSI] fix refcounting bug in scsi_get_host_dev
Browse files Browse the repository at this point in the history
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 <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Alan Stern authored and James Bottomley committed Feb 18, 2010
1 parent 75f8ee8 commit d546911
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/scsi/scsi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1909,10 +1909,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:
Expand Down

0 comments on commit d546911

Please sign in to comment.