git: f8de23b14870 - stable/15 - ixl: Initialize VF sysctl contexts before use

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Mon, 24 Aug 2026 00:53:32 UTC
The branch stable/15 has been updated by kbowling:

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

commit f8de23b148705b3c6d1c8803202d7b79bbdde8a9
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-10 04:53:08 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-24 00:45:20 +0000

    ixl: Initialize VF sysctl contexts before use
    
    The VF array is zeroed at allocation, but its sysctl contexts were
    only populated after each VF was successfully added.  If VF setup
    failed, IOV teardown still passed every requested VF context to
    sysctl_ctx_free().  An untouched context is not an initialized empty
    TAILQ and caused a page fault during teardown.
    
    Initialize every VF context with the array so both successful setup
    and partial-failure cleanup have a valid lifetime.
    
    (cherry picked from commit ae122c5443882ae4d3d19aacfcfd16a2c8d7b688)
---
 sys/dev/ixl/ixl_pf_iov.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ixl/ixl_pf_iov.c b/sys/dev/ixl/ixl_pf_iov.c
index 1e475e4767cc..2ace3e93980a 100644
--- a/sys/dev/ixl/ixl_pf_iov.c
+++ b/sys/dev/ixl/ixl_pf_iov.c
@@ -1652,7 +1652,7 @@ ixl_if_iov_init(if_ctx_t ctx, uint16_t num_vfs, const nvlist_t *params)
 	struct i40e_hw *hw;
 	struct ixl_vsi *pf_vsi;
 	enum i40e_status_code ret;
-	int error;
+	int error, i;
 
 	hw = &pf->hw;
 	pf_vsi = &pf->vsi;
@@ -1663,6 +1663,8 @@ ixl_if_iov_init(if_ctx_t ctx, uint16_t num_vfs, const nvlist_t *params)
 		error = ENOMEM;
 		goto fail;
 	}
+	for (i = 0; i < num_vfs; i++)
+		sysctl_ctx_init(&pf->vfs[i].vsi.sysctl_ctx);
 
 	/*
 	 * Add the VEB and ...