Skip to content

Commit 3ce58b0

Browse files
dmertmananguy11
authored andcommitted
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. Fixes: 776fe19 ("ice: block default rule setting on LAG interface") Signed-off-by: Dave Ertman <[email protected]> Reviewed-by: Aleksandr Loktionov <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 24171a5 commit 3ce58b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/intel/ice/ice_lag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,8 @@ bool ice_lag_is_switchdev_running(struct ice_pf *pf)
22262226
struct ice_lag *lag = pf->lag;
22272227
struct net_device *tmp_nd;
22282228

2229-
if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) || !lag)
2229+
if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) ||
2230+
!lag || !lag->upper_netdev)
22302231
return false;
22312232

22322233
rcu_read_lock();

0 commit comments

Comments
 (0)