net/mlx5: Release resource on error flow
authorMoni Shoua <monis@mellanox.com>
Thu, 8 Nov 2018 19:10:08 +0000 (21:10 +0200)
committerLeon Romanovsky <leonro@mellanox.com>
Mon, 12 Nov 2018 20:20:13 +0000 (22:20 +0200)
Fix reference counting leakage when the event handler aborts due to an
unsupported event for the resource type.

Fixes: a14c2d4beee5 ("net/mlx5_core: Warn on unsupported events of QP/RQ/SQ")
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/qp.c

index 91b8139..690dc1d 100644 (file)
@@ -132,7 +132,7 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type)
        if (!is_event_type_allowed((rsn >> MLX5_USER_INDEX_LEN), event_type)) {
                mlx5_core_warn(dev, "event 0x%.2x is not allowed on resource 0x%.8x\n",
                               event_type, rsn);
-               return;
+               goto out;
        }
 
        switch (common->res) {
@@ -150,7 +150,7 @@ void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type)
        default:
                mlx5_core_warn(dev, "invalid resource type for 0x%x\n", rsn);
        }
-
+out:
        mlx5_core_put_rsc(common);
 }