๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27388

Re: [PATCH net] qlcnic: Fix potential interrupt table leak on setup failure

#27388
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 13:04
97 lines
11482 bytes
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
Technical Details
Message-ID: <179647588931.3146.6443672227712860239@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377996-linux-kernel-netdev=dewy.ru
References: <20261204130344.2418717-1-liguangshuo@mail.sdu.edu.cn>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377996-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] qlcnic: Fix potential interrupt table leak on setup failure
Date: Sat, 05 Dec 2026 13:04:49 +0000
Organization: Usenet Network
Message-ID: <179647588931.3146.6443672227712860239@kernel.org>
References: <20261204130344.2418717-1-liguangshuo@mail.sdu.edu.cn>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="3032505"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:rC3Siv31yT4o34XrWolwP36h57M= sha256:Mj3nCXQMUOWPv9v2nV8XvJVY2+Wv361jV/7UNwm/0Fg= sha1:GOnnBqEkUI5GyzWOJ4T0oTqXhQY= sha256:GDLlC32VNht4J+wLeqMl2kSv15W/Ql6U2KcqkM5SuUQ=
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 B3E25117E25; Sat,  5 Dec 2026 16:05:10 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org
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 NeM-gvWK41NQ; Sat,  5 Dec 2026 16:05:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377996-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 67B7C117E16; Sat,  5 Dec 2026 16:04:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 9D1063154B; Sat,  5 Dec 2026 13:04:51 +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=1796475891; b=nRfpucOBPmhiCnh42mwq+TyxNnsghjsUXIdtN5QREM+OhaV4zVB/lGw7CsxQ3DPbVdMG H1lKhncLQ+2jGKpHIbKE7Ro/PT4KkiloKi8eZPEZoNjrSDmN+f4NXnbFDXhMtWZ9ynhjt E00eTZ7UTlW2LSGox37XJqujCf7knwerXUgqnHRYNuOVxuqjAD75s5BFZ46QTDzSEg2T0 HjP0kQjx92sk+Q4V4KwcVZNVX8aXZ2FQV8datVOUt8FkCBdbOp5iRpzwRT0ctf0+eg9YA NkMC7WRItNufXbOe7eO3/jblsCih2n8d7CT+kW4JJu9IfimdZ94FDqMUr15ax5Eph6A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796475891; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=SEK/j8HHVwiqmUr5dXBRdG2dHO/bETtSlbBrIL9jm8Q=; b=rfWaJ2Z4qgshcCeTSOk/iccVCwLvIXwzkf6fhk9K6di4e8y6GoPlOgV6EvYjAlJGsES+ eQzpORwHx3/AQ7SGkZC4nJr1wfSQuo0g3F6Is9aXG1wvmdQIiNI/FeDwdyYCo5F5DCOuc injuraW8CkNfg+pwnnGDtDAD9m2Z8JjMhK4DyIUSfYTPdeisHT4IBJH3tKe6CLIQr8+MJ sqI9GtNUaMZgcvIScohNnBgky+hbTZYdH5romJKIszBNhAvFFNNs1YtEKVIHl5pbmalmL YyzNM9YM3V6kib3uSq82IEh64E3Xpy1FBeTTfSx7s/9ADbcDUDGAVEJf1ba34eNsrmQ==
X-ARC-Authentication-Results: i=2; 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=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 75B46606A336; Sat,  5 Dec 2026 13:04:51 +0000 (UTC)
X-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
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-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==
X-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==
X-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
X-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)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3FF91F0092B; Sat,  5 Dec 2026 13:04:49 +0000 (UTC)
X-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==
X-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
X-In-Reply-To: <20261204130344.2418717-1-liguangshuo@mail.sdu.edu.cn>
X-sashiko-severity: High
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
X-Received-Bytes: 11285