Skip to content

Commit 5d8fc4a

Browse files
minglumlumartinkpetersen
authored andcommitted
scsi: libfc: free skb when receiving invalid flogi resp
The issue to be fixed in this commit is when libfc found it received a invalid FLOGI response from FC switch, it would return without freeing the fc frame, which is just the skb data. This would cause memory leak if FC switch keeps sending invalid FLOGI responses. This fix is just to make it execute `fc_frame_free(fp)` before returning from function `fc_lport_flogi_resp`. Signed-off-by: Ming Lu <ming.lu@citrix.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b631956 commit 5d8fc4a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/scsi/libfc/fc_lport.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,14 +1726,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
17261726
fc_frame_payload_op(fp) != ELS_LS_ACC) {
17271727
FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n");
17281728
fc_lport_error(lport, fp);
1729-
goto err;
1729+
goto out;
17301730
}
17311731

17321732
flp = fc_frame_payload_get(fp, sizeof(*flp));
17331733
if (!flp) {
17341734
FC_LPORT_DBG(lport, "FLOGI bad response\n");
17351735
fc_lport_error(lport, fp);
1736-
goto err;
1736+
goto out;
17371737
}
17381738

17391739
mfs = ntohs(flp->fl_csp.sp_bb_data) &
@@ -1743,7 +1743,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
17431743
FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, "
17441744
"lport->mfs:%hu\n", mfs, lport->mfs);
17451745
fc_lport_error(lport, fp);
1746-
goto err;
1746+
goto out;
17471747
}
17481748

17491749
if (mfs <= lport->mfs) {

0 commit comments

Comments
 (0)