Skip to content

Commit a2b81de

Browse files
committed
Merge tag 'io_uring-7.2-20260717' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring fixes from Jens Axboe: - Fix a use-after-free in the bpf-ops struct_ops path, where the same io_uring_bpf_ops map could be registered more than once. - Fix the deferred iovec free for the provided-buffer grow path, which could leave the caller with a dangling iovec and result in repeated frees. Follow-up to the earlier fix in this series. - Zero-check the unused addr3/pad2 SQE fields for unlinkat * tag 'io_uring-7.2-20260717' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: io_uring/bpf-ops: reject re-registration of an already-bound ops io_uring/fs: check unused sqe fields for unlinkat io_uring/kbuf: free the replaced iovec after a successful grow
2 parents 8b752c8 + 3afc64c commit a2b81de

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

io_uring/bpf-ops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ static int io_install_bpf(struct io_ring_ctx *ctx, struct io_uring_bpf_ops *ops)
168168

169169
if (ctx->bpf_ops)
170170
return -EBUSY;
171+
if (ops->priv)
172+
return -EBUSY;
171173
if (WARN_ON_ONCE(!ops->loop_step))
172174
return -EINVAL;
173175

io_uring/fs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ int io_unlinkat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
110110
const char __user *fname;
111111
int err;
112112

113-
if (sqe->off || sqe->len || sqe->buf_index || sqe->splice_fd_in)
113+
if (sqe->off || sqe->len || sqe->buf_index || sqe->splice_fd_in ||
114+
sqe->addr3 || sqe->__pad2[0])
114115
return -EINVAL;
115116
if (unlikely(req->flags & REQ_F_FIXED_FILE))
116117
return -EBADF;

io_uring/kbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ static int io_ring_buffers_peek(struct io_kiocb *req, struct buf_sel_arg *arg,
328328
buf = io_ring_head_to_buf(br, ++head, bl->mask);
329329
} while (--nr_iovs);
330330

331-
if (arg->mode & KBUF_MODE_FREE)
332-
kfree(arg->iovs);
331+
if (arg->iovs != org_iovs && (arg->mode & KBUF_MODE_FREE))
332+
kfree(org_iovs);
333333

334334
if (head == tail)
335335
req->flags |= REQ_F_BL_EMPTY;

0 commit comments

Comments
 (0)