Skip to content

Commit bf34e69

Browse files
committed
io_uring/net: initialize struct msghdr more sanely for io_recv()
We only need to clear the input fields on the first invocation, not when potentially doing a retry. Signed-off-by: Jens Axboe <[email protected]>
1 parent 6e76ac5 commit bf34e69

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

io_uring/net.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,14 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
860860
if (unlikely(!sock))
861861
return -ENOTSOCK;
862862

863+
msg.msg_name = NULL;
864+
msg.msg_namelen = 0;
865+
msg.msg_control = NULL;
866+
msg.msg_get_inq = 1;
867+
msg.msg_controllen = 0;
868+
msg.msg_iocb = NULL;
869+
msg.msg_ubuf = NULL;
870+
863871
retry_multishot:
864872
if (io_do_buffer_select(req)) {
865873
void __user *buf;
@@ -874,14 +882,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags)
874882
if (unlikely(ret))
875883
goto out_free;
876884

877-
msg.msg_name = NULL;
878-
msg.msg_namelen = 0;
879-
msg.msg_control = NULL;
880-
msg.msg_get_inq = 1;
881885
msg.msg_flags = 0;
882-
msg.msg_controllen = 0;
883-
msg.msg_iocb = NULL;
884-
msg.msg_ubuf = NULL;
885886

886887
flags = sr->msg_flags;
887888
if (force_nonblock)

0 commit comments

Comments
 (0)