diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-03-18 20:41:22 +0100 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 16:24:15 +0200 |
commit | 12fb8c1574d7d0c262d2f4c667047889c4f27ebe (patch) | |
tree | 32214bc5e70a401f8dab59b3d95dca790bb30424 /drivers | |
parent | [SCSI] don't reap targets upon device_add failure (diff) | |
download | linux-12fb8c1574d7d0c262d2f4c667047889c4f27ebe.tar.xz linux-12fb8c1574d7d0c262d2f4c667047889c4f27ebe.zip |
[SCSI] don't kfree an initialized struct device
This patch (as1359) fixes a bug in scsi_alloc_target(). After a
device structure has been initialized (and especially after its name
has been set), it must not be freed directly. One has to call
put_device() instead.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 38518b088073..c992ecf4e372 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -459,8 +459,7 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, found_target->reap_ref++; spin_unlock_irqrestore(shost->host_lock, flags); if (found_target->state != STARGET_DEL) { - put_device(parent); - kfree(starget); + put_device(dev); return found_target; } /* Unfortunately, we found a dying target; need to |