]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/mlx5: Release resource on error flow
authorMoni Shoua <monis@mellanox.com>
Thu, 8 Nov 2018 19:10:08 +0000 (21:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:51:12 +0000 (08:51 +0100)
[ Upstream commit 698114968a22f6c0c9f42e983ba033cc36bb7217 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/qp.c

index 4ca07bfb6b14f75760928e5df47ce911f8639f10..f33707ce8b6b0f26d9ace1d1f20e915e29f49913 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);
 }