Skip to contentSkip to conversation

scsi: bfa: release allocated memory in case of error

PATCH Applied Navid Emamdoost 2 participants 2 messages Sep 10, 2019 – Oct 1, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: bfa: release allocated memory in case of error

In bfad_im_get_stats if bfa_port_get_stats fails, allocated memory needs to be released.

---
 drivers/scsi/bfa/bfad_attr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/bfa/bfad_attr.c +3 -1
index 29ab81df75c0..fbfce02e5b93 100644
@@ -275,8 +275,10 @@ bfad_im_get_stats(struct Scsi_Host *shost)
 	rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa),
 				fcstats, bfad_hcb_comp, &fcomp);
 	spin_unlock_irqrestore(&bfad->bfad_lock, flags);
-	if (rc != BFA_STATUS_OK)
+	if (rc != BFA_STATUS_OK) {
+		kfree(fcstats);
 		return NULL;
+	}
 
 	wait_for_completion(&fcomp.comp);
 
Signature · 1 line
2.17.1
#1 lore raw

Navid,

Quoted 2 lines

In bfad_im_get_stats if bfa_port_get_stats fails, allocated memory needs to be released.

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering