Skip to content

Commit 0e62395

Browse files
Navidemmartinkpetersen
authored andcommitted
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. Link: https://lore.kernel.org/r/20190910234417.22151-1-navid.emamdoost@gmail.com Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 69be926 commit 0e62395

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: drivers/scsi/bfa/bfad_attr.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,10 @@ bfad_im_get_stats(struct Scsi_Host *shost)
275275
rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa),
276276
fcstats, bfad_hcb_comp, &fcomp);
277277
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
278-
if (rc != BFA_STATUS_OK)
278+
if (rc != BFA_STATUS_OK) {
279+
kfree(fcstats);
279280
return NULL;
281+
}
280282

281283
wait_for_completion(&fcomp.comp);
282284

0 commit comments

Comments
 (0)