summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2016-11-10 11:30:55 +0200
committerJiri Slaby <jslaby@suse.cz>2016-11-24 16:23:57 +0100
commit3ee9c742bb021ab292e97f1e26bf2a339b20310c (patch)
tree0c617f57d9f03f378783ca5e8a355f3808ddf3ec
parent270202d09fb6cdfbe89d19948c068b4487286693 (diff)
downloadlwn-3ee9c742bb021ab292e97f1e26bf2a339b20310c.tar.gz
lwn-3ee9c742bb021ab292e97f1e26bf2a339b20310c.zip
IB/mlx4: Fix create CQ error flow
commit 593ff73bcfdc79f79a8a0df55504f75ad3e5d1a9 upstream. Currently, if ib_copy_to_udata fails, the CQ won't be deleted from the radix tree and the HW (HW2SW). Fixes: 225c7b1feef1 ('IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters') Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Daniel Jurgens <danielj@mellanox.com> Reviewed-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index d5e60f44ba5a..5b8a62c6bc8d 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -239,11 +239,14 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vector
if (context)
if (ib_copy_to_udata(udata, &cq->mcq.cqn, sizeof (__u32))) {
err = -EFAULT;
- goto err_dbmap;
+ goto err_cq_free;
}
return &cq->ibcq;
+err_cq_free:
+ mlx4_cq_free(dev->dev, &cq->mcq);
+
err_dbmap:
if (context)
mlx4_ib_db_unmap_user(to_mucontext(context), &cq->db);