From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53AE1C44501 for ; Tue, 14 Jul 2026 06:41:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 01397407F0; Tue, 14 Jul 2026 06:41:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id brtv1iFn98jR; Tue, 14 Jul 2026 06:41:20 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5DA2340677 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1784011280; bh=9x4DvNuH+C01RfbWzeGiOhrWxg912eJrBFFwtdhEQP8=; h=From:To:Cc:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=u0LJY6jUE73hozxGsjpLw3aJcaVBxntFfcebp2VSEXgwu+g7DAwYS4fZrk8AITjfp svMd2LYRaSNEyuK+Vco5YbJPByS3lB2V85dkXJ+ha+QTnKTt/tOggtAKJKTzKEFAL5 73KrYWLOgrL7xtISgpRuRBWSDxss5HBKQkNSicIpZ4P5n44Yxpf/uhH9eQHtpCsX9p jElkm20FMbtWjoANmZ7zjdsdmyFEisWq9Xbx/r1abCNa6fsHjU8PUICFby8+OOvjm4 z7/Zoa3/plGtGp/706+ZTjkJKx5LGNMxaoLoCmz0QnygekKA2F6/QkSaMgqtc82s/j mIg0S79TbEl2w== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id 5DA2340677; Tue, 14 Jul 2026 06:41:20 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id DAB149CF for ; Tue, 14 Jul 2026 06:41:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C0007810CE for ; Tue, 14 Jul 2026 06:41:18 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PThrZksyv3w6 for ; Tue, 14 Jul 2026 06:41:18 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=91.218.175.180; helo=out-180.mta0.migadu.com; envelope-from=xuanqiang.luo@linux.dev; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org E94F4810C7 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E94F4810C7 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) by smtp1.osuosl.org (Postfix) with ESMTPS id E94F4810C7 for ; Tue, 14 Jul 2026 06:41:14 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: xuanqiang.luo@linux.dev To: intel-wired-lan@lists.osuosl.org Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, sridhar.samudrala@intel.com, wojciech.drewek@intel.com, piotr.raczynski@intel.com, michal.swiatkowski@linux.intel.com, jacob.e.keller@intel.com, netdev@vger.kernel.org, Xuanqiang Luo , stable@vger.kernel.org Date: Tue, 14 Jul 2026 14:39:37 +0800 Message-ID: <20260714063937.26325-1-xuanqiang.luo@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784011269; 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=9x4DvNuH+C01RfbWzeGiOhrWxg912eJrBFFwtdhEQP8=; b=pd9eBGIOrIfwNQ6qzTN6LRyVyiIqOBiW8O3vTY2F64eYmxRBU7Ayr/UIFH11UL2NzRrPVc KdX49WQjcJHPPKxSlraoRAqBegvJ/+cXgZNWDQf9bfVBYAaMLEuRUiJOs4RDyGIZVlQ79J aZQQH+6f+AoBUq50qOcJS+e1taCGKIw= X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=pd9eBGIO Subject: [Intel-wired-lan] [PATCH iwl-net v1] ice: fix use-after-free in dynamic port cleanup X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Xuanqiang Luo ice_dealloc_dynamic_port() uses dyn_port->vsi->idx to erase the dynamic port from pf->dyn_ports. However, it frees the VSI before reading the index for the erase, resulting in a use-after-free. Follow the reverse of the allocation order in ice_alloc_dynamic_port() by erasing the xarray entry before freeing the VSI. Fixes: eda69d654c7e ("ice: add basic devlink subfunctions support") Cc: stable@vger.kernel.org Signed-off-by: Xuanqiang Luo --- drivers/net/ethernet/intel/ice/devlink/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/devlink/port.c b/drivers/net/ethernet/intel/ice/devlink/port.c index 2a2e56777f9f7..3ede246490027 100644 --- a/drivers/net/ethernet/intel/ice/devlink/port.c +++ b/drivers/net/ethernet/intel/ice/devlink/port.c @@ -590,8 +590,8 @@ static void ice_dealloc_dynamic_port(struct ice_dynamic_port *dyn_port) xa_erase(&pf->sf_nums, devlink_port->attrs.pci_sf.sf); ice_eswitch_detach_sf(pf, dyn_port); - ice_vsi_free(dyn_port->vsi); xa_erase(&pf->dyn_ports, dyn_port->vsi->idx); + ice_vsi_free(dyn_port->vsi); kfree(dyn_port); } -- 2.43.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 93BCA3368AA for ; Tue, 14 Jul 2026 06:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784011273; cv=none; b=G4nmZ8DE+vj1HFk4mTUlOayyTMwctT/2iEX5KtUexZvwxdCrubdz+2b/QjPB8nT8FQLnMYQ5d3HKpJKtaJ6qE2R2j0cDNwMK+4oWrk1U13RClPkDqtgNNJJkNnkMIMVkzOdi7T+3FP+Qe2+S4pnyiV7kzG4aJyl9wk7GDji3DA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784011273; c=relaxed/simple; bh=6lyQRXk18+WT1H4J1CXUAaPIS2gpTnwnEN3m9wrS7yA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UVTTXroqHRAP+xt5tdNy/oCNXgNB2o8dCsEB6LtAuQX5JhtpOfkYOHxV4INUUtXm/WH/sqfL/c4kPUDerO1XksiVXTqhjybAd97wrxk8vJGc87VniZDEMf7KfQ9wsijFTzCbMNVu27qW+GE/RB5TWsuDvPxgsxAOy61KX/xy62c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pd9eBGIO; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pd9eBGIO" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784011269; 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=9x4DvNuH+C01RfbWzeGiOhrWxg912eJrBFFwtdhEQP8=; b=pd9eBGIOrIfwNQ6qzTN6LRyVyiIqOBiW8O3vTY2F64eYmxRBU7Ayr/UIFH11UL2NzRrPVc KdX49WQjcJHPPKxSlraoRAqBegvJ/+cXgZNWDQf9bfVBYAaMLEuRUiJOs4RDyGIZVlQ79J aZQQH+6f+AoBUq50qOcJS+e1taCGKIw= From: xuanqiang.luo@linux.dev To: intel-wired-lan@lists.osuosl.org Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, sridhar.samudrala@intel.com, wojciech.drewek@intel.com, piotr.raczynski@intel.com, michal.swiatkowski@linux.intel.com, jacob.e.keller@intel.com, netdev@vger.kernel.org, Xuanqiang Luo , stable@vger.kernel.org Subject: [PATCH iwl-net v1] ice: fix use-after-free in dynamic port cleanup Date: Tue, 14 Jul 2026 14:39:37 +0800 Message-ID: <20260714063937.26325-1-xuanqiang.luo@linux.dev> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Xuanqiang Luo ice_dealloc_dynamic_port() uses dyn_port->vsi->idx to erase the dynamic port from pf->dyn_ports. However, it frees the VSI before reading the index for the erase, resulting in a use-after-free. Follow the reverse of the allocation order in ice_alloc_dynamic_port() by erasing the xarray entry before freeing the VSI. Fixes: eda69d654c7e ("ice: add basic devlink subfunctions support") Cc: stable@vger.kernel.org Signed-off-by: Xuanqiang Luo --- drivers/net/ethernet/intel/ice/devlink/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/devlink/port.c b/drivers/net/ethernet/intel/ice/devlink/port.c index 2a2e56777f9f7..3ede246490027 100644 --- a/drivers/net/ethernet/intel/ice/devlink/port.c +++ b/drivers/net/ethernet/intel/ice/devlink/port.c @@ -590,8 +590,8 @@ static void ice_dealloc_dynamic_port(struct ice_dynamic_port *dyn_port) xa_erase(&pf->sf_nums, devlink_port->attrs.pci_sf.sf); ice_eswitch_detach_sf(pf, dyn_port); - ice_vsi_free(dyn_port->vsi); xa_erase(&pf->dyn_ports, dyn_port->vsi->idx); + ice_vsi_free(dyn_port->vsi); kfree(dyn_port); } -- 2.43.0