From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3D7AD3B994F; Tue, 21 Jul 2026 21:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670302; cv=none; b=QbE+7CFluenqzG2Dx7vh6qMEbm+afv2v9x970lJSeho8waMWYQA/czB5eDNCQe1bAkgzeYTA/RLBXEqFghoPtdvWXRq/zoeHrf7ImCJ9CziHuLpAdhGaqMhcJpWrJTYmLFzg5EvFXYSBrFm8GJdLM0W2O/QIsD1iRDxPUn+cGlk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670302; c=relaxed/simple; bh=42d3LxrXeoQyojqeuMzORyaRJzmjHg01UfttmP64PY4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QFd0L78PqXTHL1f3hwA3jxkRFhNln7LXAExmS5nK7XpH6NmNmPPiG1IKwO57PWCdhbAQSr2AV8TlUxlxDVvwiiI++whKHrwC9cTA/Lsr/cGVsTxNJZfcRzd8sAQHNZ/BzXvkKTstvQnaoz/NFxVK2Q0LIoYlQvM3b9lJ2Ex7LjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mLn+0RTl; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mLn+0RTl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F163A1F000E9; Tue, 21 Jul 2026 21:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670301; bh=i01mNUE+9P5gyU/PVA2JjRpI1EYGK6aBQpwDkF8/KsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mLn+0RTlDhKM8PzKDb1gz1WGxB0JZhMnAv4EYSehiTCpK8h6oqfh0/OwqojHVxUrR kB8mR0leHs5Z2AqWfol0Vid9IyOC046HfNzoAPlLhIiuLSF2CkjUH2/hJViu5xbWxE 7Ri199I/JW2crI27DdVh/T+sWxEHVY6QAkw8LyvE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dawei Feng , Arthur Kiyanovski , Jakub Kicinski Subject: [PATCH 6.1 0879/1067] net: ena: clean up XDP TX queues when regular TX setup fails Date: Tue, 21 Jul 2026 17:24:40 +0200 Message-ID: <20260721152444.195245782@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dawei Feng commit 1bd6676254b4ab6acd44b662b5e92822c036463a upstream. create_queues_with_size_backoff() creates XDP TX queues before setting up the regular TX path. If the subsequent allocation or creation of regular TX queues fails, the error handling paths omit the teardown of the XDP TX queues, leading to a resource leak. Fix this by explicitly destroying the XDP TX queue subset at the two missing failure points. The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1-rc7. An x86_64 allyesconfig build showed no new warnings. As we do not have an ENA device to test with, no runtime testing was able to be performed. Fixes: 548c4940b9f1 ("net: ena: Implement XDP_TX action") Cc: stable@vger.kernel.org Signed-off-by: Dawei Feng Reviewed-by: Arthur Kiyanovski Tested-by: Arthur Kiyanovski Link: https://patch.msgid.link/20260616142424.4005130-1-dawei.feng@seu.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amazon/ena/ena_netdev.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c @@ -1257,6 +1257,18 @@ static void ena_destroy_all_tx_queues(st } } +static void ena_destroy_xdp_tx_queues(struct ena_adapter *adapter) +{ + u16 ena_qid; + int i; + + for (i = adapter->xdp_first_ring; + i < adapter->xdp_first_ring + adapter->xdp_num_queues; i++) { + ena_qid = ENA_IO_TXQ_IDX(i); + ena_com_destroy_io_queue(adapter->ena_dev, ena_qid); + } +} + static void ena_destroy_all_rx_queues(struct ena_adapter *adapter) { u16 ena_qid; @@ -2618,14 +2630,21 @@ static int create_queues_with_size_backo rc = ena_setup_tx_resources_in_range(adapter, 0, adapter->num_io_queues); - if (rc) + if (rc) { + ena_destroy_xdp_tx_queues(adapter); + ena_free_all_io_tx_resources_in_range(adapter, + adapter->xdp_first_ring, + adapter->xdp_num_queues); goto err_setup_tx; + } rc = ena_create_io_tx_queues_in_range(adapter, 0, adapter->num_io_queues); - if (rc) + if (rc) { + ena_destroy_xdp_tx_queues(adapter); goto err_create_tx_queues; + } rc = ena_setup_all_rx_resources(adapter); if (rc)