Skip to content

Commit 08e74be

Browse files
paravmellanoxjgunthorpe
authored andcommitted
RDMA/uverbs: Fix error cleanup path of ib_uverbs_add_one()
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 <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent f40f299 commit 08e74be

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/infiniband/core/uverbs_main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
10501050
uverbs_dev->num_comp_vectors = device->num_comp_vectors;
10511051

10521052
if (ib_uverbs_create_uapi(device, uverbs_dev))
1053-
goto err;
1053+
goto err_uapi;
10541054

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

10781078
err_class:
10791079
device_destroy(uverbs_class, uverbs_dev->cdev.dev);
1080-
10811080
err_cdev:
10821081
cdev_del(&uverbs_dev->cdev);
1082+
err_uapi:
10831083
clear_bit(devnum, dev_map);
1084-
10851084
err:
10861085
if (atomic_dec_and_test(&uverbs_dev->refcount))
10871086
ib_uverbs_comp_dev(uverbs_dev);

0 commit comments

Comments
 (0)