> -----Original Message----- > From: lirongqing <liro…@baidu.com> > Sent: Thursday, December 3, 2026 9:14 AM > To: Nguyen, Anthony L <anth…@intel.com>; Kitszel, Przemyslaw > <prze…@intel.com>; Andrew Lunn <andr…@lunn.ch>; > David S . Miller <dav…@davemloft.net>; Eric Dumazet > <edum…@kernel.org>; Jakub Kicinski <ku…@kernel.org>; Paolo Abeni > <pabe…@redhat.com>; Ertman, David M <davi…@intel.com>; Daniel > Machon <dani…@microchip.com>; inte…@lists.osuosl.org; > netd…@vger.kernel.org > Cc: Li RongQing <liro…@baidu.com> > Subject: [PATCH,net,v2] ice: Fix uninitialized ndlist in > ice_lag_rebuild() > > From: Li RongQing <liro…@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 <liro…@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
Reviewed-by: Aleksandr Loktionov <alek…@intel.com>