public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix page leak in io_sqe_buffer_register()
@ 2025-06-17 12:39 Penglei Jiang
  2025-06-17 12:53 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Penglei Jiang @ 2025-06-17 12:39 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, linux-kernel, Penglei Jiang

Add missing unpin_user_pages() in the error path

Fixes: d8c2237d0aa9 ("io_uring: add io_pin_pages() helper")
Signed-off-by: Penglei Jiang <superman.xpt@gmail.com>
---
 io_uring/rsrc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index c592ceace97d..f5ac1b530e21 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -804,8 +804,10 @@ static struct io_rsrc_node *io_sqe_buffer_register(struct io_ring_ctx *ctx,
 	}
 
 	imu = io_alloc_imu(ctx, nr_pages);
-	if (!imu)
+	if (!imu) {
+		unpin_user_pages(pages, nr_pages);
 		goto done;
+	}
 
 	imu->nr_bvecs = nr_pages;
 	ret = io_buffer_account_pin(ctx, pages, nr_pages, imu, last_hpage);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-17 14:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 12:39 [PATCH] io_uring: fix page leak in io_sqe_buffer_register() Penglei Jiang
2025-06-17 12:53 ` Jens Axboe
2025-06-17 14:02   ` Penglei Jiang
2025-06-17 14:29     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox