Commit d5469119f0098881ab7f991990ef4f81ef13a194

Authored by Alan Stern
Committed by James Bottomley
1 parent 75f8ee8e01

[SCSI] fix refcounting bug in scsi_get_host_dev

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>

Showing 1 changed file with 2 additions and 3 deletions Side-by-side Diff

drivers/scsi/scsi_scan.c
... ... @@ -1909,10 +1909,9 @@
1909 1909 goto out;
1910 1910  
1911 1911 sdev = scsi_alloc_sdev(starget, 0, NULL);
1912   - if (sdev) {
1913   - sdev->sdev_gendev.parent = get_device(&starget->dev);
  1912 + if (sdev)
1914 1913 sdev->borken = 0;
1915   - } else
  1914 + else
1916 1915 scsi_target_reap(starget);
1917 1916 put_device(&starget->dev);
1918 1917 out: