Article View: linux.kernel.netdev
Article #9576[PATCH iwl-net 3/6] ice: clear stale rate_node pointers in ice_tear_down_devlink_rate_tree()
From: Przemek Kitszel
Date: Mon, 02 Nov 2026 10:50
Date: Mon, 02 Nov 2026 10:50
61 lines
11678 bytes
11678 bytes
ice_tear_down_devlink_rate_tree() frees the devlink rate nodes with
devl_rate_nodes_destroy(), but leaves ice_sched_node::rate_node pointing at
them. The pointers are only reset when the last representor goes away, in
ice_eswitch_detach().
If DCB is turned on and off again while representors exist, the next
ice_devlink_rate_init_tx_topology() (e.g. on adding an SF port) sees the
stale pointers as already exported nodes and passes one of them as the
parent to devl_rate_leaf_create(), which writes to freed memory.
Clear the pointers before destroying the nodes, as ice_eswitch_detach() does.
dcbnl ops can call ice_tear_down_devlink_rate_tree() while a reset is in
flight, or after a failed one, when the Tx scheduler tree is gone. Make
ice_devlink_rate_clear_tx_topology() skip the clearing then, as other Tx
scheduler helpers do when the port is not ready.
Reproducer:
PF=eth3
BDF=$(basename $(readlink /sys/class/net/$PF/device))
ethtool --set-priv-flags $PF fw-lldp-agent off
devlink dev eswitch set pci/$BDF mode switchdev
echo 1 > /sys/class/net/$PF/device/sriov_numvfs
dcb ets set dev $PF tc-tsa all:ets tc-bw all:0 0:50 1:50 prio-tc all:0 4:1
dcb ets set dev $PF tc-tsa all:ets tc-bw all:0 0:100 prio-tc all:0
devlink port add pci/$BDF flavour pcisf pfnum 0 sfnum 1
BUG: KASAN: slab-use-after-free in devl_rate_leaf_create+0x109/0x390
Fixes: 86197ad5800b ("ice: set Tx topology every time new repr is added")
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/ice/devlink/devlink.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index 8c2b63eef82b..044aa62be473 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -705,6 +705,7 @@ void ice_tear_down_devlink_rate_tree(struct ice_pf *pf)
}
mutex_unlock(&pf->vfs.table_lock);
+ ice_devlink_rate_clear_tx_topology(ice_get_main_vsi(pf));
devl_rate_nodes_destroy(devlink);
devl_unlock(devlink);
}
@@ -842,6 +843,10 @@ void ice_devlink_rate_clear_tx_topology(struct ice_vsi *vsi)
{
struct ice_port_info *pi = vsi->port_info;
+ /* the Tx scheduler tree is gone during a reset */
+ if (pi->port_state != ICE_SCHED_PORT_STATE_READY)
+ return;
+
mutex_lock(&pi->sched_lock);
ice_clear_rate_nodes(pi->root->children[0]);
mutex_unlock(&pi->sched_lock);
--
2.54.0
Technical Details
Message-ID:
<20261102105346.30739-4-przemyslaw.kitszel@intel.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354589-linux-kernel-netdev=dewy.ruReferences:
<20261102105346.30739-1-przemyslaw.kitszel@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354589-linux-kernel-netdev=dewy.ru From: przemyslaw.kitszel@intel.com (Przemek Kitszel) Newsgroups: linux.kernel.netdev Subject: [PATCH iwl-net 3/6] ice: clear stale rate_node pointers in ice_tear_down_devlink_rate_tree() Date: Mon, 2 Nov 2026 11:50:18 +0100 Organization: Usenet Network Message-ID: <20261102105346.30739-4-przemyslaw.kitszel@intel.com> References: <20261102105346.30739-1-przemyslaw.kitszel@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2904442"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mIt/unz13/q4gUaEJeLNYKChIlY= sha256:CDh0cQv3T7uDcP2RP1snNqBvekaLl6uww1FUdMrjPAw= sha1:X6IvxTo3JWRwfv4fAlqnuPcrj94= sha256:DjkboC1+69SBuZ7t4ZlaVHYToaSdyghEhRodHS1M1RI= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E5A321124AC; Mon, 2 Nov 2026 13:48:34 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.151 X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6_pk8oeVv4GY; Mon, 2 Nov 2026 13:48:32 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-354589-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 6AE48112453; Mon, 2 Nov 2026 13:48:24 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 2133F6076CF; Mon, 2 Nov 2026 10:46:44 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793616399; b=gfPWo3OrbflEcLW+KAUqfA8PXobABXD57vhizH9Xi+ag7CvfWWfGJyBy+3gdK2nWjCy2 qNX4FsVq8NCfh+H4KognWIfnW1Z6FvLK/fPh9xbQjNk86mNnOuPSVHO2I8e0DvASfy5hr bCg8zwK1oI5QvVvym6qqosmEMtqHSWFq9UoZZr3ldvSw9LJWsR1TSf/EgiGyrRF8NuNpQ IIGbeBssAX/VjKv43JFnbNKvaGK8ahip6rVzuRxLkOM/TEMZCFmUowHoneAbRvI/rZ8GS gs86hsO+B1v9zLoXo+hfjDLI72dyKQVXHAUf9SPYEiDsm/aUOTLJTxgJMC/OFMTHVbw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793616399; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV:X-IronPort-AV: Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV: Received:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=EpbIBsCL2Gelwm0gnFKEDFKVP67syfArtemZZbQZRac=; b=CRQnAPQQ5F3CxmdVaaz4uhGbj8r+TZqMXkAnnmOPLuyJYN5HUy0+sG5qaRsGkT6YTD9R esXG7cGGpdLrVhF1BdnkyCchwOvIDt8NZMOwebmKrl4Cv88wF12b27QMdHANC4nO2RJUF NZ2JaMdMmqvbbBsYmuKZ+aeJ/0oK9H4XePq8SabwHo8OpWa1o+5E7LWdfbMWpvfzWqM5J 9pYpm8pIs48XVg58V0KHO7Wqw6JCGV5kRFNt1W0H88RKfVpV3iiMQZ7DF3K47qWFSpham NYqx1NxBwDBfbpfS4H8EJBpqn85SExbw4r6YkKSbkqtFShxEBvF6negrAPArZhGf76w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=kx6oPeiK; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 843CD606A32D; Mon, 2 Nov 2026 10:46:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=kx6oPeiK X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.15 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793616398; b=YJkr8j3LIJ5g4NUOWHRV/qHbHM/OHewv9stcm3ojPtiSh8CrGrxJ0DVjeYQaCDYMZz4I L7ivU/sheysTwNzynuDGofZddInJRt0CKVJaxQm2saOxNF2eX+nCZfPNtQBPwtsdojMyT KOgvbq4WMRYK0IKahH9qbCdTG6aAJXPAaSW4GC8LBo0GT046OCX3b+Q3RxecpOQx2ubQE hUaTrJI9lGr9NoUHztdfR64gvQf2LggHucXQ4OGfcv7SRiKnzE6JVMOwVnC1KmCjJsUga kaD6k/eWc7GQimEoXXokUe3jQoq3OnxGGU3g7kHOIJ3is6z8cIX1FseMQ7XOBCN6Gug== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793616398; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=EpbIBsCL2Gelwm0gnFKEDFKVP67syfArtemZZbQZRac=; b=GgNjpmQ6S+EsHEtC9OprrX3rYPqSsAbGA6uuZ4ga1ZU+fUIpDPoop8HHhG/U1N1NdjmQ Uuz2IKBFJbaD8iei/pHVY3h9iDMFaqpZbgxDD+WDjU/Os/1EgemaIFKyiNnDKsVGNwy6N AT8iR8efN+QA4pDP9uIX1XzatrZmrjlbTS/FOvoyw5Xb/MItoTZCW0s814Eln1h5vNW0o 9iuM5SzgDCbJSH3NlQJxzzrlzFgcBKtgJUL6evuHc1BrD+tpCaI7nTXYGzExZpJEcUbPy B9WU1K6slEQ90S2M++EXT1dE8zeG9gFT+Z5noM6w/SGLrwAenN7iWAJEE1l3XNfKEUQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=kx6oPeiK; arc=none smtp.remote-ip=192.198.163.15 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54D36606A32E for <netdev@vger.kernel.org>; Mon, 2 Nov 2026 10:46:36 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 54D36606A32E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1793616396; x=1825152396; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZZ31yo5800+JACi9OIQacH893m5RVhuD/0Qx7nxKPVY=; b=kx6oPeiKI4dlh2smo3T0AxYSUAOxmcDQYfnukkvJxtK03wtHWZUalOw6 vMQR9+nI9lc5+o/FHMSDzcg+jpqNn35C/y+827WVthvRMwPSwSunwGCgT RfT7sv/GA3OHYjJ2iCBwCY9IIvzURgmkimlhdJNi8wcWgt82hxfx1cC3W Qd02fRKWXaCftT5d+3HuT62jXAVp7Qz5KOR+wUYYe385X64yvP0S75uJn 0xLgfdvqXS6spb8KWZNo0Z0Yf6Hj9K++X5NcNayD02vhTymxOObcdkONm cvNSVCkrnjqqsxTbEvj9S0Me5bUsmdyg8xDRVtM+IszGat4xXuT98jo3S g==; X-CSE-ConnectionGUID: CPt8BrMOTpOniB8I6V6/MA== X-CSE-MsgGUID: 1SEi5l+rR/OX6tG6FkA9wg== X-IronPort-AV: E=McAfee;i="6800,10657,11953"; a="2305029" X-IronPort-AV: E=Sophos;i="6.27,191,1787036400"; d="scan'208";a="2305029" X-Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2026 02:46:31 -0800 X-CSE-ConnectionGUID: 90pEQXsLSIK9ChzcXryxbg== X-CSE-MsgGUID: kmT0w3QZTj+bplELH8X9ww== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,191,1787036400"; d="scan'208";a="6012005" X-Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orviesa004.jf.intel.com with ESMTP; 02 Nov 2026 02:46:30 -0800 X-Received: from pkitszel-desk1.igk.intel.com (pkitszel-desk1.igk.intel.com [10.217.184.18]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 4B1612876C; Mon, 2 Nov 2026 10:46:29 +0000 (GMT) X-Cc: netdev@vger.kernel.org, Przemek Kitszel <przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.54.0 X-In-Reply-To: <20261102105346.30739-1-przemyslaw.kitszel@intel.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list