ice: Don't tx before switchdev is fully configured
authorWojciech Drewek <wojciech.drewek@intel.com>
Wed, 12 Jul 2023 11:03:28 +0000 (13:03 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 24 Jul 2023 15:52:43 +0000 (08:52 -0700)
There is possibility that ice_eswitch_port_start_xmit might be
called while some resources are still not allocated which might
cause NULL pointer dereference. Fix this by checking if switchdev
configuration was finished.

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_eswitch.c

index be5b226..15a4c14 100644 (file)
@@ -331,6 +331,9 @@ ice_eswitch_port_start_xmit(struct sk_buff *skb, struct net_device *netdev)
        np = netdev_priv(netdev);
        vsi = np->vsi;
 
+       if (!vsi || !ice_is_switchdev_running(vsi->back))
+               return NETDEV_TX_BUSY;
+
        if (ice_is_reset_in_progress(vsi->back->state) ||
            test_bit(ICE_VF_DIS, vsi->back->state))
                return NETDEV_TX_BUSY;