Netdev List
 help / color / mirror / Atom feed
From: lirongqing <lirongqing@baidu.com>
To: Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Dave Ertman <david.m.ertman@intel.com>,
	Daniel Machon <daniel.machon@microchip.com>,
	<intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>
Cc: Li RongQing <lirongqing@baidu.com>
Subject: [PATCH,net,v2] ice: Fix uninitialized ndlist in ice_lag_rebuild()
Date: Thu, 3 Dec 2026 16:13:38 +0800	[thread overview]
Message-ID: <20261203081338.2175-1-lirongqing@baidu.com> (raw)

From: Li RongQing <lirongqing@baidu.com>

ice_lag_rebuild() only populates ndlist on the non-primary path, yet it
unconditionally passes ndlist to ice_lag_destroy_netdev_list() on exit.
When rebuilding on a primary interface, ndlist.node is never initialized
and the cleanup path walks uninitialized stack memory, passing bogus
pointers to kfree().

Keep ndlist local to the block that actually needs it and build, use and
destroy it there. This removes the need to initialize a list head that
the primary path never touches.

Found by code review and compile-tested only

Fixes: 3579aa86fb40 ("ice: update reset path for SRIOV LAG support")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
Diff with v1: move ndlist to the needed block

 drivers/net/ethernet/intel/ice/ice_lag.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
index 08a17de..8f78380 100644
--- a/drivers/net/ethernet/intel/ice/ice_lag.c
+++ b/drivers/net/ethernet/intel/ice/ice_lag.c
@@ -2699,7 +2699,6 @@ void ice_deinit_lag(struct ice_pf *pf)
  */
 void ice_lag_rebuild(struct ice_pf *pf)
 {
-	struct ice_lag_netdev_list ndlist;
 	struct ice_lag *lag, *prim_lag;
 	u8 act_port, loc_port;
 
@@ -2712,8 +2711,11 @@ void ice_lag_rebuild(struct ice_pf *pf)
 	if (lag->primary) {
 		prim_lag = lag;
 	} else {
+		struct ice_lag_netdev_list ndlist;
+
 		ice_lag_build_netdev_list(lag, &ndlist);
 		prim_lag = ice_lag_find_primary(lag);
+		ice_lag_destroy_netdev_list(lag, &ndlist);
 	}
 
 	if (!prim_lag) {
@@ -2746,7 +2748,6 @@ void ice_lag_rebuild(struct ice_pf *pf)
 
 	ice_clear_rdma_cap(pf);
 lag_rebuild_out:
-	ice_lag_destroy_netdev_list(lag, &ndlist);
 	mutex_unlock(&pf->lag_mutex);
 }
 
-- 
2.9.4


             reply	other threads:[~2026-12-03  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  8:13 lirongqing [this message]
2026-12-04 14:55 ` [PATCH,net,v2] ice: Fix uninitialized ndlist in ice_lag_rebuild() Loktionov, Aleksandr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203081338.2175-1-lirongqing@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=david.m.ertman@intel.com \
    --cc=edumazet@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox