diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-11-08 15:51:55 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-11-08 16:13:34 -0500 |
commit | 2ef8919830a262f10fb5e4a685e95f71a64bce6c (patch) | |
tree | 5490ee9197f0e30fed2073719c2d6382ac13e8aa /drivers/scsi | |
parent | 34ea80ec6a02ad02e6b9c75c478c18e5880d6713 (diff) |
[SCSI] Fix refcount leak in scsi_report_lun_scan
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_scan.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 7eb3a2d40dc5..27bcc8fb8cbc 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -1074,6 +1074,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
1074 | struct scsi_sense_hdr sshdr; | 1074 | struct scsi_sense_hdr sshdr; |
1075 | struct scsi_device *sdev; | 1075 | struct scsi_device *sdev; |
1076 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 1076 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
1077 | int ret = 0; | ||
1077 | 1078 | ||
1078 | /* | 1079 | /* |
1079 | * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. | 1080 | * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. |
@@ -1169,8 +1170,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
1169 | /* | 1170 | /* |
1170 | * The device probably does not support a REPORT LUN command | 1171 | * The device probably does not support a REPORT LUN command |
1171 | */ | 1172 | */ |
1172 | kfree(lun_data); | 1173 | ret = 1; |
1173 | return 1; | 1174 | goto out_err; |
1174 | } | 1175 | } |
1175 | 1176 | ||
1176 | /* | 1177 | /* |
@@ -1238,6 +1239,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
1238 | } | 1239 | } |
1239 | } | 1240 | } |
1240 | 1241 | ||
1242 | out_err: | ||
1241 | kfree(lun_data); | 1243 | kfree(lun_data); |
1242 | out: | 1244 | out: |
1243 | scsi_device_put(sdev); | 1245 | scsi_device_put(sdev); |
@@ -1246,7 +1248,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags, | |||
1246 | * the sdev we used didn't appear in the report luns scan | 1248 | * the sdev we used didn't appear in the report luns scan |
1247 | */ | 1249 | */ |
1248 | scsi_destroy_sdev(sdev); | 1250 | scsi_destroy_sdev(sdev); |
1249 | return 0; | 1251 | return ret; |
1250 | } | 1252 | } |
1251 | 1253 | ||
1252 | struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, | 1254 | struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, |