Skip to content

Commit 2d280bc

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix recvmsg setup with compat buf-select
__io_compat_recvmsg_copy_hdr() with REQ_F_BUFFER_SELECT reads out iov len but never assigns it to iov/fast_iov, leaving sr->len with garbage. Hopefully, following io_buffer_select() truncates it to the selected buffer size, but the value is still may be under what was specified. Cc: <[email protected]> # 5.7 Signed-off-by: Pavel Begunkov <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent af60470 commit 2d280bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/io_uring.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4499,7 +4499,8 @@ static int __io_compat_recvmsg_copy_hdr(struct io_kiocb *req,
44994499
return -EFAULT;
45004500
if (clen < 0)
45014501
return -EINVAL;
4502-
sr->len = iomsg->iov[0].iov_len;
4502+
sr->len = clen;
4503+
iomsg->iov[0].iov_len = clen;
45034504
iomsg->iov = NULL;
45044505
} else {
45054506
ret = __import_iovec(READ, (struct iovec __user *)uiov, len,

0 commit comments

Comments
 (0)