> -----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
> 
> 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: 776fe19953b0 ("ice: block default rule setting on LAG
> interface")
> Signed-off-by: Dave Ertman <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
> ---
>  drivers/net/ethernet/intel/ice/ice_lag.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c
> b/drivers/net/ethernet/intel/ice/ice_lag.c
> index c5e3ada4746c..e22f2e5a3b19 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lag.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lag.c
> @@ -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

Reply via email to