git: cb5152f961bb - stable/13 - iflib: Fix panic during driver reload stress test

From: Eric Joyner <erj_at_FreeBSD.org>
Date: Thu, 24 Aug 2023 21:06:39 UTC
The branch stable/13 has been updated by erj:

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

commit cb5152f961bbb89b186ee76aaa8eb631f21cf6c4
Author:     Przemyslaw Lewandowski <przemyslawx.lewandowski@intel.com>
AuthorDate: 2023-07-27 22:47:12 +0000
Commit:     Eric Joyner <erj@FreeBSD.org>
CommitDate: 2023-08-24 21:04:16 +0000

    iflib: Fix panic during driver reload stress test
    
    During a driver reload stress test, after 50-300 reloads a panic occurs.
    After adding sleeps in between loading and unloading the driver, the
    issue does not occur.  It's possible that loading/unloading too fast may
    cause the gt_taskqueue pointer to be freed earlier than expected;
    checking for a null pointer first fixes it.
    
    Signed-off-by: Eric Joyner <erj@FreeBSD.org>
    
    Reviewed by:    erj@
    Tested by:      jeffrey.e.pieper@intel.com
    Sponsored by:   Intel Corporation
    Differential Revision:  https://reviews.freebsd.org/D39457
    
    (cherry picked from commit 04d4e34538cf8f8ac99b5aa1c6c50b626d976dfd)
---
 sys/net/iflib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 763ce3adf64b..2ee246170211 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -1628,7 +1628,8 @@ iflib_fast_intr_ctx(void *arg)
 			return (result);
 	}
 
-	GROUPTASK_ENQUEUE(gtask);
+	if (gtask->gt_taskqueue != NULL)
+		GROUPTASK_ENQUEUE(gtask);
 	return (FILTER_HANDLED);
 }