ice: add NULL check in eswitch lag check
Subsystems (2)
PATCH v2 1/1 ice: add NULL check in eswitch lag check
The function ice_lag_is_switchdev_running() is being called from outside of the LAG event handler code. This results in the lag->upper_netdev being NULL sometimes. To avoid a NULL-pointer dereference, there needs to be a check before it is dereferenced.
--- drivers/net/ethernet/intel/ice/ice_lag.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ice/ice_lag.c +3 -0
@@ -2798,6 +2798,9 @@ bool ice_lag_is_switchdev_running(struct ice_pf *pf)if (!ice_is_feature_supported (pf,ICE_F_SRIOV_LAG ) || !lag)return false; +if (!lag->upper_netdev) +return false; +rcu_read_lock ();for_each_netdev_in_bond_rcu (lag->upper_netdev, tmp_nd) {struct ice_netdev_priv *priv =netdev_priv (tmp_nd);
Signature · 1 line
2.49.0
Quoted 10 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Dave Ertman
Sent: Thursday, May 22, 2025 7:17 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH iwl-net v2] ice: add NULL check in eswitch lag check
Quoted 8 lines
The function
ice_lag_is_switchdev_running()is being called from outside of the LAG event handler code. This results in the lag-Quoted 1 line
upper_netdevbeing NULL sometimes. To avoid a NULL-pointerdereference, there needs to be a check before it is dereferenced.
Fixes 776fe19953b0 ("ice: block default rule setting on LAGinterface")
Signed-off-by Dave Ertman <[email protected]>
Quoted 22 lines
--- drivers/net/ethernet/intel/ice/ice_lag.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/ethernet/intel/ice/ice_lag.c +3
-0@@ -2798,6 +2798,9 @@ bool ice_lag_is_switchdev_running(struct ice_pf *pf)if (!ice_is_feature_supported (pf,ICE_F_SRIOV_LAG ) || !lag)return false; +if (!lag->upper_netdev) +return false; +rcu_read_lock ();for_each_netdev_in_bond_rcu (lag->upper_netdev, tmp_nd) {struct
ice_netdev_priv*priv =netdev_priv(tmp_nd);
--
2.49.0
Quoted 13 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Dave Ertman
Sent: Thursday, May 22, 2025 10:47 PM
To: [email protected]
Subject: [Intel-wired-lan] [PATCH iwl-net v2] ice: add NULL check in eswitch lag checkThe function
ice_lag_is_switchdev_running()is being called from outside of the LAG event handler code. This results in thelag->upper_netdevbeing NULL sometimes. To avoid a NULL-pointer dereference, there needs to be a check before it is dereferenced.
Quoted 6 lines
Fixes 776fe19953b0 ("ice: block default rule setting on LAG interface")Signed-off-by Dave Ertman <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lag.c | 3 +++ 1 file changed, 3 insertions(+)