git: a3d71fffa786 - main - cfiscsi_done: Free the dummy PDU earlier.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 07 Feb 2022 20:55:29 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=a3d71fffa78619fb394b8bb595d2ef680bd0e43a

commit a3d71fffa78619fb394b8bb595d2ef680bd0e43a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-07 20:55:08 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-02-07 20:55:08 +0000

    cfiscsi_done: Free the dummy PDU earlier.
    
    The dummy PDU needs to be freed before marking task abortion complete
    as otherwise cfiscsi_session_terminate_tasks can return and destroy
    the session in another thread before the PDU is freed.
    
    Fixes:          2e8d1a55258d iscsi: Allocate a dummy PDU for the internal nexus reset task.
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D34176
---
 sys/cam/ctl/ctl_frontend_iscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 9827491dba4d..cccb3fd90317 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -3062,11 +3062,11 @@ cfiscsi_done(union ctl_io *io)
 		/*
 		 * Implicit task termination has just completed; nothing to do.
 		 */
+		icl_pdu_free(request);
 		cs->cs_tasks_aborted = true;
 		refcount_release(&cs->cs_outstanding_ctl_pdus);
 		wakeup(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus));
 		ctl_free_io(io);
-		icl_pdu_free(request);
 		return;
 	default:
 		panic("cfiscsi_done called with wrong opcode 0x%x",