Skip to content

Commit 9172dbf

Browse files
Ming Leiaxboe
authored andcommitted
ublk: handle ublk_set_auto_buf_reg() failure correctly in ublk_fetch()
If ublk_set_auto_buf_reg() fails, we need to unlock and return, otherwise `ub->mutex` is leaked. Fixes: 99c1e4e ("ublk: register buffer to local io_uring with provided buf index via UBLK_F_AUTO_BUF_REG") Reported-by: Caleb Sander Mateos <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Caleb Sander Mateos <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 6f1a182 commit 9172dbf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/ublk_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ static int ublk_fetch(struct io_uring_cmd *cmd, struct ublk_queue *ubq,
20752075
if (ublk_support_auto_buf_reg(ubq)) {
20762076
ret = ublk_set_auto_buf_reg(cmd);
20772077
if (ret)
2078-
return ret;
2078+
goto out;
20792079
}
20802080

20812081
ublk_fill_io_cmd(io, cmd, buf_addr);

0 commit comments

Comments
 (0)