From nobody Sat Feb 7 13:45:58 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8773030C60B for ; Mon, 2 Feb 2026 10:18:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770027507; cv=none; b=GHLkhEshxpvW4ecFkDntLoyjLeojLx7BGWaF9eDs5ca92xpqRJVqfIykh+p+Cshtt10JFhGc75Gb+mrnecUhouF1n11eTsrOCWg2OK21BadmIakF7XL9ILvrdElBuIhvYh6CPE6EZoTq7NSptgbql1ZsuO61usf8pOJFxbTJYnk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770027507; c=relaxed/simple; bh=2mSffkAlx2LWmOLKktkDUc/RWeoA2F8mcxyQ4brpPo8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gj+7aewUTXPpvtcf2qLcxBrzeYCZEpIjeT0gDGvMJ/HInQCYrtOJ+E8Metl3AZsbT0gU26xjoFonZjn7gxkhC2GPgIqGfWWGVtAOQ1HY77jCy0l/zoojtWHdzlYjxlDBAtcqh1maDg8C/oa064DGJa+Si3Ab2bB5bxnzoigHpRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Vj/0PrfI; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Vj/0PrfI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770027504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QwkSiX1Hp8rIk3qxgAOsnlMj5FGX8DKdzbss4//3U/M=; b=Vj/0PrfIQDl2mesD2IDxUy3zRl00k5fqlbqCZ0KCP572hdFJsV0Smquam9531mQiSfqYIK PDdDfzD8HcBvsYg1rOCQ1+Fl1fPNkyJ1UNQpFNkps0NCFyC3fky0Rs6kP90tSTLgTUE2+4 /dBHAO8+BQhxYwNFHeBQiQ5rvtIDR00= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-261-EV51GaeONfiBLUq-hmGr9A-1; Mon, 02 Feb 2026 05:18:22 -0500 X-MC-Unique: EV51GaeONfiBLUq-hmGr9A-1 X-Mimecast-MFC-AGG-ID: EV51GaeONfiBLUq-hmGr9A_1770027499 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 77DC2195606F; Mon, 2 Feb 2026 10:18:19 +0000 (UTC) Received: from rhel-developer-toolbox-latest (unknown [10.43.3.143]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 37F9D19560A2; Mon, 2 Feb 2026 10:18:16 +0000 (UTC) From: Michal Schmidt To: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexander Lobakin , Jacob Keller , Michal Kubiak Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] ice: fix crash in ethtool offline loopback test Date: Mon, 2 Feb 2026 11:17:54 +0100 Message-ID: <20260202101755.315528-1-mschmidt@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Since the conversion of ice to page pool, the ethtool loopback test crashes: BUG: kernel NULL pointer dereference, address: 000000000000000c #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 1100f1067 P4D 0 Oops: Oops: 0002 [#1] SMP NOPTI CPU: 23 UID: 0 PID: 5904 Comm: ethtool Kdump: loaded Not tainted 6.19.0-0.= rc7.260128g1f97d9dcf5364.49.eln154.x86_64 #1 PREEMPT(lazy) Hardware name: [...] RIP: 0010:ice_alloc_rx_bufs+0x1cd/0x310 [ice] Code: 83 6c 24 30 01 66 41 89 47 08 0f 84 c0 00 00 00 41 0f b7 dc 48 8b 44= 24 18 48 c1 e3 04 41 bb 00 10 00 00 48 8d 2c 18 8b 04 24 <89> 45 0c 41 8b = 4d 00 49 d3 e3 44 3b 5c 24 24 0f 83 ac fe ff ff 44 RSP: 0018:ff7894738aa1f768 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000700 RDI: 0000000000000000 RBP: 0000000000000000 R08: ff16dcae79880200 R09: 0000000000000019 R10: 0000000000000001 R11: 0000000000001000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: ff16dcae6c670000 FS: 00007fcf428850c0(0000) GS:ff16dcb149710000(0000) knlGS:00000000000000= 00 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000000000c CR3: 0000000121227005 CR4: 0000000000773ef0 PKRU: 55555554 Call Trace: ice_vsi_cfg_rxq+0xca/0x460 [ice] ice_vsi_cfg_rxqs+0x54/0x70 [ice] ice_loopback_test+0xa9/0x520 [ice] ice_self_test+0x1b9/0x280 [ice] ethtool_self_test+0xe5/0x200 __dev_ethtool+0x1106/0x1a90 dev_ethtool+0xbe/0x1a0 dev_ioctl+0x258/0x4c0 sock_do_ioctl+0xe3/0x130 __x64_sys_ioctl+0xb9/0x100 do_syscall_64+0x7c/0x700 entry_SYSCALL_64_after_hwframe+0x76/0x7e [...] It crashes because we have not initialized libeth for the rx ring. Fix it by treating ICE_VSI_LB VSIs slightly more like normal PF VSIs and letting them have a q_vector. It's just a dummy, because the loopback test does not use interrupts, but it contains a napi struct that can be passed to libeth_rx_fq_create() called from ice_vsi_cfg_rxq() -> ice_rxq_pp_create(). Fixes: 93f53db9f9dc ("ice: switch to Page Pool") Signed-off-by: Michal Schmidt Reviewed-by: Aleksandr Loktionov --- drivers/net/ethernet/intel/ice/ice_base.c | 5 ++++- drivers/net/ethernet/intel/ice/ice_ethtool.c | 4 ++++ drivers/net/ethernet/intel/ice/ice_lib.c | 15 ++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethern= et/intel/ice/ice_base.c index eadb1e3d12b3..f0da50df6791 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.c +++ b/drivers/net/ethernet/intel/ice/ice_base.c @@ -124,6 +124,8 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, = u16 v_idx) if (vsi->type =3D=3D ICE_VSI_VF) { ice_calc_vf_reg_idx(vsi->vf, q_vector); goto out; + } else if (vsi->type =3D=3D ICE_VSI_LB) { + goto skip_alloc; } else if (vsi->type =3D=3D ICE_VSI_CTRL && vsi->vf) { struct ice_vsi *ctrl_vsi =3D ice_get_vf_ctrl_vsi(pf, vsi); =20 @@ -662,7 +664,8 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring) u32 rx_buf_len; int err; =20 - if (ring->vsi->type =3D=3D ICE_VSI_PF || ring->vsi->type =3D=3D ICE_VSI_S= F) { + if (ring->vsi->type =3D=3D ICE_VSI_PF || ring->vsi->type =3D=3D ICE_VSI_S= F || + ring->vsi->type =3D=3D ICE_VSI_LB) { if (!xdp_rxq_info_is_reg(&ring->xdp_rxq)) { err =3D __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, ring->q_index, diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/eth= ernet/intel/ice/ice_ethtool.c index 3565a5d96c6d..e9f2618950c8 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -1289,6 +1289,10 @@ static u64 ice_loopback_test(struct net_device *netd= ev) test_vsi->netdev =3D netdev; tx_ring =3D test_vsi->tx_rings[0]; rx_ring =3D test_vsi->rx_rings[0]; + /* Dummy q_vector and napi. Fill the minimum required for + * ice_rxq_pp_create(). + */ + rx_ring->q_vector->napi.dev =3D netdev; =20 if (ice_lbtest_prepare_rings(test_vsi)) { ret =3D 2; diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/etherne= t/intel/ice/ice_lib.c index d47af94f31a9..bad67e4dc044 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -107,10 +107,6 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi) if (!vsi->rxq_map) goto err_rxq_map; =20 - /* There is no need to allocate q_vectors for a loopback VSI. */ - if (vsi->type =3D=3D ICE_VSI_LB) - return 0; - /* allocate memory for q_vector pointers */ vsi->q_vectors =3D devm_kcalloc(dev, vsi->num_q_vectors, sizeof(*vsi->q_vectors), GFP_KERNEL); @@ -239,6 +235,8 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi) case ICE_VSI_LB: vsi->alloc_txq =3D 1; vsi->alloc_rxq =3D 1; + /* A dummy q_vector, no actual IRQ. */ + vsi->num_q_vectors =3D 1; break; default: dev_warn(ice_pf_to_dev(pf), "Unknown VSI type %d\n", vsi_type); @@ -2424,14 +2422,21 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi) } break; case ICE_VSI_LB: - ret =3D ice_vsi_alloc_rings(vsi); + ret =3D ice_vsi_alloc_q_vectors(vsi); if (ret) goto unroll_vsi_init; =20 + ret =3D ice_vsi_alloc_rings(vsi); + if (ret) + goto unroll_alloc_q_vector; + ret =3D ice_vsi_alloc_ring_stats(vsi); if (ret) goto unroll_vector_base; =20 + /* Simply map the dummy q_vector to the only rx_ring */ + vsi->rx_rings[0]->q_vector =3D vsi->q_vectors[0]; + break; default: /* clean up the resources and exit */ --=20 2.52.0