io_uring/net: correctly handle multishot recvmsg retry setup

[ Upstream commit deaef31bc1 ]

If we loop for multishot receive on the initial attempt, and then abort
later on to wait for more, we miss a case where we should be copying the
io_async_msghdr from the stack to stable storage. This leads to the next
retry potentially failing, if the application had the msghdr on the
stack.

Cc: stable@vger.kernel.org
Fixes: 9bb66906f2 ("io_uring: support multishot in recvmsg")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jens Axboe 2024-03-07 17:48:03 -07:00 committed by Greg Kroah-Hartman
parent 3a342fa318
commit 220778af6c
1 changed files with 2 additions and 1 deletions

View File

@ -876,7 +876,8 @@ retry_multishot:
kfree(kmsg->free_iov);
io_netmsg_recycle(req, issue_flags);
req->flags &= ~REQ_F_NEED_CLEANUP;
}
} else if (ret == -EAGAIN)
return io_setup_async_msg(req, kmsg, issue_flags);
return ret;
}