Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 958f6e40 authored by Javed Hasan's avatar Javed Hasan Committed by Greg Kroah-Hartman
Browse files

scsi: libfc: Free skb in fc_disc_gpn_id_resp() for valid cases

[ Upstream commit ec007ef40abb6a164d148b0dc19789a7a2de2cc8 ]

In fc_disc_gpn_id_resp(), skb is supposed to get freed in all cases except
for PTR_ERR. However, in some cases it didn't.

This fix is to call fc_frame_free(fp) before function returns.

Link: https://lore.kernel.org/r/20200729081824.30996-2-jhasan@marvell.com


Reviewed-by: default avatarGirish Basrur <gbasrur@marvell.com>
Reviewed-by: default avatarSantosh Vernekar <svernekar@marvell.com>
Reviewed-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Reviewed-by: default avatarShyam Sundar <ssundar@marvell.com>
Signed-off-by: default avatarJaved Hasan <jhasan@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4afde5c2
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -595,8 +595,12 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
	mutex_lock(&disc->disc_mutex);
	if (PTR_ERR(fp) == -FC_EX_CLOSED)
		goto out;
	if (IS_ERR(fp))
		goto redisc;
	if (IS_ERR(fp)) {
		mutex_lock(&disc->disc_mutex);
		fc_disc_restart(disc);
		mutex_unlock(&disc->disc_mutex);
		goto out;
	}

	cp = fc_frame_payload_get(fp, sizeof(*cp));
	if (!cp)
@@ -621,7 +625,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
				new_rdata->disc_id = disc->disc_id;
				lport->tt.rport_login(new_rdata);
			}
			goto out;
			goto free_fp;
		}
		rdata->disc_id = disc->disc_id;
		lport->tt.rport_login(rdata);
@@ -635,6 +639,8 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
redisc:
		fc_disc_restart(disc);
	}
free_fp:
	fc_frame_free(fp);
out:
	mutex_unlock(&disc->disc_mutex);
	kref_put(&rdata->kref, lport->tt.rport_destroy);