err_mtx mark was deleted in v1 along with some checks. In v2 and later new error checks were added (that cbt already exists or we hit a limit) but we forgot to release the mutex. Re-introduce err_mtx.
Fixes: e10d691405b5 ("block/blk-cbt: allow multiple cbts in a single queue") Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> --- block/blk-cbt.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/block/blk-cbt.c b/block/blk-cbt.c index fa472aa5d006..0ebde7157ba6 100644 --- a/block/blk-cbt.c +++ b/block/blk-cbt.c @@ -633,11 +633,15 @@ static int cbt_ioc_init(struct block_device *bdev, struct blk_user_cbt_info __us q = bdev_get_queue(bdev); mutex_lock(&cbt_mutex); - if (blk_cbt_find(q, ci.ci_name)) - return -EEXIST; + if (blk_cbt_find(q, ci.ci_name)) { + ret = -EEXIST; + goto err_mtx; + } - if (list_count_nodes(&q->cbt_list) == CBT_MAX_ENTRIES) - return -E2BIG; + if (list_count_nodes(&q->cbt_list) == CBT_MAX_ENTRIES) { + ret = -E2BIG; + goto err_mtx; + } cbt = do_cbt_alloc(q, ci.ci_name, i_size_read(bdev->bd_inode), ci.ci_blksize); if (IS_ERR(cbt)) @@ -645,6 +649,7 @@ static int cbt_ioc_init(struct block_device *bdev, struct blk_user_cbt_info __us else list_add_tail_rcu(&cbt->list, &q->cbt_list); +err_mtx: mutex_unlock(&cbt_mutex); return ret; } -- 2.39.3 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel