Skip to content

Commit

Permalink
RDMA/uverbs: Fix error cleanup path of ib_uverbs_add_one()
Browse files Browse the repository at this point in the history
If ib_uverbs_create_uapi() fails, dev_num should be freed from the bitmap.

Fixes: 7d96c9b ("IB/uverbs: Have the core code create the uverbs_root_spec")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Parav Pandit authored and Jason Gunthorpe committed Sep 5, 2018
1 parent f40f299 commit 08e74be
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
uverbs_dev->num_comp_vectors = device->num_comp_vectors;

if (ib_uverbs_create_uapi(device, uverbs_dev))
goto err;
goto err_uapi;

cdev_init(&uverbs_dev->cdev, NULL);
uverbs_dev->cdev.owner = THIS_MODULE;
Expand All @@ -1077,11 +1077,10 @@ static void ib_uverbs_add_one(struct ib_device *device)

err_class:
device_destroy(uverbs_class, uverbs_dev->cdev.dev);

err_cdev:
cdev_del(&uverbs_dev->cdev);
err_uapi:
clear_bit(devnum, dev_map);

err:
if (atomic_dec_and_test(&uverbs_dev->refcount))
ib_uverbs_comp_dev(uverbs_dev);
Expand Down

0 comments on commit 08e74be

Please sign in to comment.