diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c 
b/drivers/net/ethernet/intel/ice/ice_sched.c
index a5c7a4e1c..ae4528347 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.c
+++ b/drivers/net/ethernet/intel/ice/ice_sched.c
@@ -909,6 +909,14 @@ ice_sched_add_elems(struct ice_port_info *pi, struct 
ice_sched_node *tc_node,
        int status = 0;
        u32 teid;
+ /* parent->children[] holds hw->max_children[] entries for the parent's
+        * layer and ice_sched_add_node() appends to it unconditionally, so the
+        * request has to be bounded before any node is created.
+        */

we have to trust FW, I would rather do nothing than add such prevention
--

side note: I was working on a OOT bug that manifested in crash a couple
lines down from here - FW was returning 0 as number of children after
a change to 5 layer topology from 9 layer

a fix was to properly re-ask for current topology during the vsi rebuild

+       if (parent->num_children + num_nodes >
+           hw->max_children[parent->tx_sched_layer])
+               return -ENOSPC;
+
        buf_size = struct_size(buf, generic, num_nodes);
        buf = devm_kzalloc(ice_hw_to_dev(hw), buf_size, GFP_KERNEL);
        if (!buf)

base-commit: 25faec9ce61c01fb45abf812a222c5b43c3cd5c5

Reply via email to