Commit 3ce58b01 authored by Dave Ertman's avatar Dave Ertman Committed by Tony Nguyen
Browse files

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: 776fe199 ("ice: block default rule setting on LAG interface")
Signed-off-by: default avatarDave Ertman <david.m.ertman@intel.com>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 24171a5a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2226,7 +2226,8 @@ bool ice_lag_is_switchdev_running(struct ice_pf *pf)
	struct ice_lag *lag = pf->lag;
	struct net_device *tmp_nd;

	if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) || !lag)
	if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) ||
	    !lag || !lag->upper_netdev)
		return false;

	rcu_read_lock();