Skip to content

Commit 503b9c1

Browse files
scsi: libfc: Fix use after free in fc_exch_abts_resp()
jira VULN-49947 cve CVE-2022-49114 commit-author Jianglei Nie <niejianglei2021@163.com> commit 271add1 fc_exch_release(ep) will decrease the ep's reference count. When the reference count reaches zero, it is freed. But ep is still used in the following code, which will lead to a use after free. Return after the fc_exch_release() call to avoid use after free. Link: https://lore.kernel.org/r/20220303015115.459778-1-niejianglei2021@163.com Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jianglei Nie <niejianglei2021@163.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit 271add1) Signed-off-by: Pratham Patel <ppatel@ciq.com>
1 parent 3a57639 commit 503b9c1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/libfc/fc_exch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,7 @@ static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp)
17011701
if (cancel_delayed_work_sync(&ep->timeout_work)) {
17021702
FC_EXCH_DBG(ep, "Exchange timer canceled due to ABTS response\n");
17031703
fc_exch_release(ep); /* release from pending timer hold */
1704+
return;
17041705
}
17051706

17061707
spin_lock_bh(&ep->ex_lock);

0 commit comments

Comments
 (0)