mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 10:44:14 +08:00
io_uring: fix 32-bit compatability with sendmsg/recvmsg
We must set MSG_CMSG_COMPAT if we're in compatability mode, otherwise the iovec import for these commands will not do the right thing and fail the command with -EINVAL. Found by running the test suite compiled as 32-bit. Cc: stable@vger.kernel.org Fixes:aa1fa28fc7
("io_uring: add support for recvmsg()") Fixes:0fa03c624d
("io_uring: add support for sendmsg()") Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
bebdb65e07
commit
d876836204
@ -3001,6 +3001,11 @@ static int io_sendmsg_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr));
|
||||
sr->len = READ_ONCE(sqe->len);
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
if (req->ctx->compat)
|
||||
sr->msg_flags |= MSG_CMSG_COMPAT;
|
||||
#endif
|
||||
|
||||
if (!io || req->opcode == IORING_OP_SEND)
|
||||
return 0;
|
||||
/* iovec is already imported */
|
||||
@ -3153,6 +3158,11 @@ static int io_recvmsg_prep(struct io_kiocb *req,
|
||||
sr->msg = u64_to_user_ptr(READ_ONCE(sqe->addr));
|
||||
sr->len = READ_ONCE(sqe->len);
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
if (req->ctx->compat)
|
||||
sr->msg_flags |= MSG_CMSG_COMPAT;
|
||||
#endif
|
||||
|
||||
if (!io || req->opcode == IORING_OP_RECV)
|
||||
return 0;
|
||||
/* iovec is already imported */
|
||||
|
Loading…
Reference in New Issue
Block a user