scsi: hpsa: Fix memory leak in hpsa_init_one()
[ Upstream commit af61bc1e33d2c0ec22612b46050f5b58ac56a962 ] When hpsa_scsi_add_host() fails, h->lastlogicals is leaked since it is missing a free() in the error handler. Fix this by adding free() when hpsa_scsi_add_host() fails. Link: https://lore.kernel.org/r/20201027073125.14229-1-keitasuzuki.park@sslab.ics.keio.ac.jp Tested-by: Don Brace <don.brace@microchip.com> Acked-by: Don Brace <don.brace@microchip.com> Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
325455358e
commit
7f6df0b085
|
@ -8854,7 +8854,7 @@ reinit_after_soft_reset:
|
||||||
/* hook into SCSI subsystem */
|
/* hook into SCSI subsystem */
|
||||||
rc = hpsa_scsi_add_host(h);
|
rc = hpsa_scsi_add_host(h);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
|
goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
|
||||||
|
|
||||||
/* Monitor the controller for firmware lockups */
|
/* Monitor the controller for firmware lockups */
|
||||||
h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
|
h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
|
||||||
|
@ -8869,6 +8869,8 @@ reinit_after_soft_reset:
|
||||||
HPSA_EVENT_MONITOR_INTERVAL);
|
HPSA_EVENT_MONITOR_INTERVAL);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */
|
||||||
|
kfree(h->lastlogicals);
|
||||||
clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
|
clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
|
||||||
hpsa_free_performant_mode(h);
|
hpsa_free_performant_mode(h);
|
||||||
h->access.set_intr_mask(h, HPSA_INTR_OFF);
|
h->access.set_intr_mask(h, HPSA_INTR_OFF);
|
||||||
|
|
Loading…
Reference in New Issue