]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: fix double unlock for pbuf select
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 12 Jun 2022 13:31:38 +0000 (14:31 +0100)
committerPavel Begunkov <asml.silence@gmail.com>
Mon, 13 Jun 2022 10:37:41 +0000 (11:37 +0100)
io_buffer_select(), which is the only caller of io_ring_buffer_select(),
fully handles locking, mutex unlock in io_ring_buffer_select() will lead
to double unlock.

Fixes: c7fb19428d67d ("io_uring: add support for ring mapped supplied buffers")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
fs/io_uring.c

index 84b45ed91b2d3b2e5e69d18cdc80d5b9a93a309c..4719eaee3b4538bcd71122f2a0424ad1e9d28596 100644 (file)
@@ -3849,10 +3849,8 @@ static void __user *io_ring_buffer_select(struct io_kiocb *req, size_t *len,
        struct io_uring_buf *buf;
        __u32 head = bl->head;
 
-       if (unlikely(smp_load_acquire(&br->tail) == head)) {
-               io_ring_submit_unlock(req->ctx, issue_flags);
+       if (unlikely(smp_load_acquire(&br->tail) == head))
                return NULL;
-       }
 
        head &= bl->mask;
        if (head < IO_BUFFER_LIST_BUF_PER_PAGE) {