Skip to content

Commit 6f3b6e9

Browse files
committed
Merge tag 'io_uring-6.18-20251016' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring fixes from Jens Axboe: - Revert of a change that went into an older kernel, and which has been reported to cause a regression for some write workloads on LVM while a snapshop is being created - Fix a regression from this merge window, where some compilers (and/or certain .config options) would cause an earlier evaluations of a dereference which would then cause a NULL pointer dereference. I was only able to reproduce this with OPTIMIZE_FOR_SIZE=y, but David Howells hit it with just KASAN enabled. Depending on how things inlined, this makes sense - Fix for a missing lock around a mem region unregistration - Fix for ring resizing with the same placement after resize * tag 'io_uring-6.18-20251016' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: io_uring/rw: check for NULL io_br_sel when putting a buffer io_uring: fix unexpected placement on same size resizing io_uring: protect mem region deregistration Revert "io_uring/rw: drop -EOPNOTSUPP check in __io_complete_rw_common()"
2 parents 0c8df15 + 18d6b17 commit 6f3b6e9

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

io_uring/register.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,6 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
421421
if (unlikely(ret))
422422
return ret;
423423

424-
/* nothing to do, but copy params back */
425-
if (p.sq_entries == ctx->sq_entries && p.cq_entries == ctx->cq_entries) {
426-
if (copy_to_user(arg, &p, sizeof(p)))
427-
return -EFAULT;
428-
return 0;
429-
}
430-
431424
size = rings_size(p.flags, p.sq_entries, p.cq_entries,
432425
&sq_array_offset);
433426
if (size == SIZE_MAX)
@@ -613,6 +606,7 @@ static int io_register_mem_region(struct io_ring_ctx *ctx, void __user *uarg)
613606
if (ret)
614607
return ret;
615608
if (copy_to_user(rd_uptr, &rd, sizeof(rd))) {
609+
guard(mutex)(&ctx->mmap_lock);
616610
io_free_region(ctx, &ctx->param_region);
617611
return -EFAULT;
618612
}

io_uring/rw.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ static void __io_complete_rw_common(struct io_kiocb *req, long res)
542542
{
543543
if (res == req->cqe.res)
544544
return;
545-
if (res == -EAGAIN && io_rw_should_reissue(req)) {
545+
if ((res == -EOPNOTSUPP || res == -EAGAIN) && io_rw_should_reissue(req)) {
546546
req->flags |= REQ_F_REISSUE | REQ_F_BL_NO_RECYCLE;
547547
} else {
548548
req_set_fail(req);
@@ -655,13 +655,17 @@ static int kiocb_done(struct io_kiocb *req, ssize_t ret,
655655
if (ret >= 0 && req->flags & REQ_F_CUR_POS)
656656
req->file->f_pos = rw->kiocb.ki_pos;
657657
if (ret >= 0 && !(req->ctx->flags & IORING_SETUP_IOPOLL)) {
658+
u32 cflags = 0;
659+
658660
__io_complete_rw_common(req, ret);
659661
/*
660662
* Safe to call io_end from here as we're inline
661663
* from the submission path.
662664
*/
663665
io_req_io_end(req);
664-
io_req_set_res(req, final_ret, io_put_kbuf(req, ret, sel->buf_list));
666+
if (sel)
667+
cflags = io_put_kbuf(req, ret, sel->buf_list);
668+
io_req_set_res(req, final_ret, cflags);
665669
io_req_rw_cleanup(req, issue_flags);
666670
return IOU_COMPLETE;
667671
} else {

0 commit comments

Comments
 (0)