linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: fix memory leak if qlt_add_target fails
@ 2020-08-09 22:11 Navid Emamdoost
  0 siblings, 0 replies; only message in thread
From: Navid Emamdoost @ 2020-08-09 22:11 UTC (permalink / raw)
  To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel
  Cc: emamd001, Navid Emamdoost

In the implementation of qla2x00_probe_one() the allocated and
initialized ha is leaked if it fails to add target via qlt_add_target().
Go to error handling path if qlt_add_target() fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/scsi/qla2xxx/qla_os.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index e92fad99338c..81a58ae54909 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3457,7 +3457,9 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	    base_vha->host_no,
 	    ha->isp_ops->fw_version_str(base_vha, fw_str, sizeof(fw_str)));
 
-	qlt_add_target(ha, base_vha);
+	ret = qlt_add_target(ha, base_vha);
+	if (ret)
+		goto probe_failed;
 
 	clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-09 22:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-09 22:11 [PATCH] scsi: qla2xxx: fix memory leak if qlt_add_target fails Navid Emamdoost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).