net/mlx5: Fix QoS reference leak in vport enable error path
authorCarolina Jubran <cjubran@nvidia.com>
Wed, 20 Aug 2025 13:32:06 +0000 (16:32 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 21 Aug 2025 14:58:31 +0000 (07:58 -0700)
Add missing esw_qos_put() call when __esw_qos_alloc_node() fails in
mlx5_esw_qos_vport_enable().

Fixes: be034baba83e ("net/mlx5: Make vport QoS enablement more flexible for future extensions")
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Link: https://patch.msgid.link/20250820133209.389065-6-mbloch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c

index 452a948a3e6d22a53bc5bfb8549a7dec9365d317..41aec07bb6c208b473e9781a05f09c02f4e35200 100644 (file)
@@ -1109,8 +1109,10 @@ static int mlx5_esw_qos_vport_enable(struct mlx5_vport *vport, enum sched_node_t
 
        parent_esw = parent ? parent->esw : esw;
        sched_node = __esw_qos_alloc_node(parent_esw, 0, type, parent);
-       if (!sched_node)
+       if (!sched_node) {
+               esw_qos_put(esw);
                return -ENOMEM;
+       }
        if (!parent)
                list_add_tail(&sched_node->entry, &esw->qos.domain->nodes);