git: 345739ccaccc - stable/13 - cfiscsi_done: Free the dummy PDU earlier.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 29 Apr 2022 23:12:42 UTC
The branch stable/13 has been updated by jhb:

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

commit 345739ccaccce822a24a5ef9121accce541ed6de
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-02-07 20:55:08 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-29 23:07:49 +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
    
    (cherry picked from commit a3d71fffa78619fb394b8bb595d2ef680bd0e43a)
---
 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 1d7ed8ef87ef..87cf173ca8fe 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",