hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
....@@ -1334,7 +1334,8 @@
13341334 uplink_priv = &rpriv->uplink_priv;
13351335
13361336 mutex_lock(&uplink_priv->unready_flows_lock);
1337
- unready_flow_del(flow);
1337
+ if (flow_flag_test(flow, NOT_READY))
1338
+ unready_flow_del(flow);
13381339 mutex_unlock(&uplink_priv->unready_flows_lock);
13391340 }
13401341
....@@ -1344,9 +1345,9 @@
13441345 struct netlink_ext_ack *extack)
13451346 {
13461347 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
1347
- struct net_device *out_dev, *encap_dev = NULL;
13481348 struct mlx5e_tc_flow_parse_attr *parse_attr;
13491349 struct mlx5_flow_attr *attr = flow->attr;
1350
+ struct net_device *encap_dev = NULL;
13501351 struct mlx5_esw_flow_attr *esw_attr;
13511352 struct mlx5_fc *counter = NULL;
13521353 struct mlx5e_rep_priv *rpriv;
....@@ -1391,16 +1392,22 @@
13911392 esw_attr = attr->esw_attr;
13921393
13931394 for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++) {
1395
+ struct net_device *out_dev;
13941396 int mirred_ifindex;
13951397
13961398 if (!(esw_attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP))
13971399 continue;
13981400
13991401 mirred_ifindex = parse_attr->mirred_ifindex[out_index];
1400
- out_dev = __dev_get_by_index(dev_net(priv->netdev),
1401
- mirred_ifindex);
1402
+ out_dev = dev_get_by_index(dev_net(priv->netdev), mirred_ifindex);
1403
+ if (!out_dev) {
1404
+ NL_SET_ERR_MSG_MOD(extack, "Requested mirred device not found");
1405
+ err = -ENODEV;
1406
+ return err;
1407
+ }
14021408 err = mlx5e_attach_encap(priv, flow, out_dev, out_index,
14031409 extack, &encap_dev, &encap_valid);
1410
+ dev_put(out_dev);
14041411 if (err)
14051412 return err;
14061413
....@@ -1469,8 +1476,7 @@
14691476
14701477 mlx5e_put_flow_tunnel_id(flow);
14711478
1472
- if (flow_flag_test(flow, NOT_READY))
1473
- remove_unready_flow(flow);
1479
+ remove_unready_flow(flow);
14741480
14751481 if (mlx5e_is_offloaded_flow(flow)) {
14761482 if (flow_flag_test(flow, SLOW))