From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796475890; b=dRPLRwYTkt8QaTmwpKfhr2bAWSbnfjlCaQRt68MX9YgpM9A1wBWlNafY/IQOeMgBo4fc nhDj8FMOWEU5p6b8kTXK3mp11f3wqn8CxPnDhwKAh0rddC77GtetFZ9IC31lTFIGg9+dP HZd/FPy15YNpt7Q23ql97m8We8/Ym/EksDXkJAIvneyPVJoL66f3CQHdbnsJgmRgKVqwa qvGSuqW8B6HSDmzv/ZWVmFeB/M8g+dm7ulQx3d4Bqs+Di+iIc3W0MBSijsGcNdYWYS6GZ piJIfpUsig85qvyUTJzfm/oPzsupAszJ8ZT7nBjxlxY7w4/faIg2d4n0723SHhuKlgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796475890; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=SEK/j8HHVwiqmUr5dXBRdG2dHO/bETtSlbBrIL9jm8Q=; b=YPLjOfhYOYr6R3XdWJtcfZTRCzyq8fqSl8cNyYxDirDJu6kj7I7huiMz/iMXpHHOsZqj 6dsv3B+RR0SP7iyBLyIftGo6NJdSbpXHnJz0v6P06VGbxWwIGyDt2IwYVD8JQLGSdB+xc gXumuyPi95LSU3s7BdvQk5TEKGWfcqEr/GYLo7h0rDjeThmhfJqssZfd92TjymGpOtJ5H UAgnXL0tYXeYTBEOgsM4xqBhefkRo7pXYvgMeDGG2xRD8H0QADPNuhj3/Dn7Jr24+mdP4 OczUe9gu9BI3RMHFncmxeSXU21eaLe2EBpbqKTGHhn/JHPIzxoFXhJnDfpaju27EdBg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e6VyPac9; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94E6C606A322; Sat, 5 Dec 2026 13:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=e6VyPac9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3FF91F0092B; Sat, 5 Dec 2026 13:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796475890; bh=SEK/j8HHVwiqmUr5dXBRdG2dHO/bETtSlbBrIL9jm8Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=e6VyPac9kgSg8EnOF3nyHqvIl9HSzFsEuaYm7jyByu2FmfHx9K+wJGDaVuDd5YTHA duE6OVoHgZg+KfinuVEI1go3PQ8XUv1NvzbvYakDcncawZDlFvvPF8YQQO9xHlG7Fx h708uz/+4J5M9LwoTuXcWv1muzFSkRxARkSHMCYBZOYV5N+f/eMa9NHshu/nTT+vyy r9GAlyLiIRSuc+y2zKrkelrM3eRDs50+eSoypVyVV7CVBrwr1/54MRD0sZ5UU9n4VW LoolHzF2fW6qulcYlbEx86zqYtT8eO1OD1xhJu9gTLK9nKLwWCi1q4E6RHFFsz8ufZ vavH4ruSX0BFA== Subject: Re: [PATCH net] qlcnic: Fix potential interrupt table leak on setup failure From: netdev-bot+sashiko@kernel.org To: liguangshuo@mail.sdu.edu.cn Cc: shshaikh@marvell.com, manishc@marvell.com, gr-linux-nic-dev@marvell.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, himanshu.madhani@qlogic.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 05 Dec 2026 13:04:49 +0000 Message-ID: <179647588931.3146.6443672227712860239@kernel.org> In-Reply-To: <20261204130344.2418717-1-liguangshuo@mail.sdu.edu.cn> References: <20261204130344.2418717-1-liguangshuo@mail.sdu.edu.cn> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] The fix is incomplete. -- qlcnic: Fix potential interrupt table leak on setup failure The patch frees ahw->intr_tbl in qlcnic_82xx_mq_intrpt() when qlcnic_82xx_config_intrpt() fails. Without this, a later open would allocate a new table and overwrite the saved pointer. > diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c > index ff4f7cd20c791..ddd0c51dca106 100644 > --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c > +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c > @@ -897,10 +897,13 @@ int qlcnic_82xx_mq_intrpt(struct qlcnic_adapter *adapter, int op_type) > } > > err = qlcnic_82xx_config_intrpt(adapter, 1); > - if (err) > + if (err) { > dev_err(&adapter->pdev->dev, > "Failed to configure Interrupt for %d vector\n", > ahw->num_msix); > + vfree(ahw->intr_tbl); > + ahw->intr_tbl = NULL; > + } > return err; > } [Severity: High] Does this fix cover every place where "a later open allocates another table and overwrites the saved pointer"? qlcnic_82xx_mq_intrpt() assigns a fresh table every time it runs, and never checks for or frees an existing one: ahw->intr_tbl = vzalloc(array_size(sizeof(struct qlcnic_intrpt_config), ahw->num_msix)); It runs on every interface up: __qlcnic_up() qlcnic_fw_create_ctx() qlcnic_82xx_mq_intrpt(dev, 1) The matching teardown on the down path is qlcnic_fw_destroy_ctx() in qlcnic_ctx.c. It sends the firmware DEL but does not free the table: if (qlcnic_82xx_check(adapter) && (adapter->flags & QLCNIC_MSIX_ENABLED) && qlcnic_check_multi_tx(adapter) && !adapter->ahw->diag_test) qlcnic_82xx_config_intrpt(adapter, 0); The err_out path in qlcnic_fw_create_ctx() works the same way when qlcnic_fw_cmd_create_rx_ctx() or qlcnic_fw_cmd_create_tx_ctx() fails after qlcnic_82xx_mq_intrpt() has succeeded: err_out: if (qlcnic_82xx_check(dev) && (dev->flags & QLCNIC_MSIX_ENABLED) && qlcnic_check_multi_tx(dev) && !dev->ahw->diag_test) qlcnic_82xx_config_intrpt(dev, 0); qlcnic_teardown_intr() is the only place that vfree()s the 82xx table. It runs on probe failure, remove, suspend and interrupt re-setup. It does not run on ndo_stop, ndo_open or a context reset. So on an 82xx adapter with MSI-X and multi-TX firmware, wouldn't each of these still leak the previous intr_tbl? - ip link set dev X down / up, via qlcnic_close()->__qlcnic_down() and then qlcnic_open()->__qlcnic_up() - qlcnic_reset_context(), for example from the ethtool set_ringparam path - qlcnic_reset_hw_context(), via qlcnic_down()/qlcnic_up() - qlcnic_diag_free_res(), which clears diag_test and calls __qlcnic_up() again Could the table be freed and set to NULL wherever the firmware DEL is sent, meaning qlcnic_fw_destroy_ctx() and the qlcnic_fw_create_ctx() err_out path? Another option is for qlcnic_82xx_mq_intrpt() to free or reuse any existing table before it allocates a new one. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204130344.2418717-1-liguangshuo%40mail.sdu.edu.cn