diff mbox series

[1/1] io_uring/net: fix cleanup after recycle

Message ID 9e326f4ad4046ddadf15bf34bf3fa58c6372f6b5.1671461985.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series [1/1] io_uring/net: fix cleanup after recycle | expand

Commit Message

Pavel Begunkov Dec. 19, 2022, 3:11 p.m. UTC
Don't access io_async_msghdr io_netmsg_recycle(), it may be reallocated.

Cc: stable@vger.kernel.org
Fixes: 9bb66906f23e5 ("io_uring: support multishot in recvmsg")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Dec. 19, 2022, 5 p.m. UTC | #1
On Mon, 19 Dec 2022 15:11:40 +0000, Pavel Begunkov wrote:
> Don't access io_async_msghdr io_netmsg_recycle(), it may be reallocated.
> 
> 

Applied, thanks!

[1/1] io_uring/net: fix cleanup after recycle
      commit: 6c3e8955d4bd9811a6e1761eea412a14fb51a2e6

Best regards,
diff mbox series

Patch

diff --git a/io_uring/net.c b/io_uring/net.c
index 5229976cb582..7395b2c99f86 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -819,10 +819,10 @@  int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags)
 		goto retry_multishot;
 
 	if (mshot_finished) {
-		io_netmsg_recycle(req, issue_flags);
 		/* fast path, check for non-NULL to avoid function call */
 		if (kmsg->free_iov)
 			kfree(kmsg->free_iov);
+		io_netmsg_recycle(req, issue_flags);
 		req->flags &= ~REQ_F_NEED_CLEANUP;
 	}