public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 5.13] io_uring: fix misaccounting fix buf pinned pages
@ 2021-05-29 11:01 Pavel Begunkov
  2021-05-30  1:27 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-05-29 11:01 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: Andres Freund

As Andres reports "... io_sqe_buffer_register() doesn't initialize imu.
io_buffer_account_pin() does imu->acct_pages++, before calling
io_account_mem(ctx, imu->acct_pages).", leading to evevntual -ENOMEM.

Initialise the field.

Reported-by: Andres Freund <[email protected]>
Fixes: 41edf1a5ec967 ("io_uring: keep table of pointers to ubufs")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 903458afd56c..42380ed563c4 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8228,6 +8228,7 @@ static int io_buffer_account_pin(struct io_ring_ctx *ctx, struct page **pages,
 {
 	int i, ret;
 
+	imu->acct_pages = 0;
 	for (i = 0; i < nr_pages; i++) {
 		if (!PageCompound(pages[i])) {
 			imu->acct_pages++;
-- 
2.31.1


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

* Re: [PATCH 5.13] io_uring: fix misaccounting fix buf pinned pages
  2021-05-29 11:01 [PATCH 5.13] io_uring: fix misaccounting fix buf pinned pages Pavel Begunkov
@ 2021-05-30  1:27 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-05-30  1:27 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: Andres Freund

On 5/29/21 5:01 AM, Pavel Begunkov wrote:
> As Andres reports "... io_sqe_buffer_register() doesn't initialize imu.
> io_buffer_account_pin() does imu->acct_pages++, before calling
> io_account_mem(ctx, imu->acct_pages).", leading to evevntual -ENOMEM.
> 
> Initialise the field.

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-05-30  1:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-29 11:01 [PATCH 5.13] io_uring: fix misaccounting fix buf pinned pages Pavel Begunkov
2021-05-30  1:27 ` Jens Axboe

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