* [PATCH 0/1] io_uring: fix bad free in io_sqe_files_register
@ 2019-04-21 1:42 Dan Robertson
2019-04-21 1:42 ` [PATCH 1/1] " Dan Robertson
0 siblings, 1 reply; 4+ messages in thread
From: Dan Robertson @ 2019-04-21 1:42 UTC (permalink / raw)
To: Jens Axboe, linux-block; +Cc: Dan Robertson
If io_sqe_files_register is called but returns EFAULT or EBADF the
io_ring_ctx user_files member is cleaned up, but a following call to
io_sqe_files_unregister will double-free.
Dan Robertson (1):
io_uring: fix bad free in io_sqe_files_register
fs/io_uring.c | 1 +
1 file changed, 1 insertion(+)
--
2.21.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] io_uring: fix bad free in io_sqe_files_register
2019-04-21 1:42 [PATCH 0/1] io_uring: fix bad free in io_sqe_files_register Dan Robertson
@ 2019-04-21 1:42 ` Dan Robertson
2019-04-21 1:58 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Dan Robertson @ 2019-04-21 1:42 UTC (permalink / raw)
To: Jens Axboe, linux-block; +Cc: Dan Robertson
Given bad input to the io_uring_register syscall the io_ring_ctx
user_files member is cleaned up in io_sqe_files_register, but a
following call to io_uring_release will result in a double-free.
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
---
fs/io_uring.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index bbdbd56cf2ac..07d6ef195d05 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2215,6 +2215,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
fput(ctx->user_files[i]);
kfree(ctx->user_files);
+ ctx->user_files = NULL;
ctx->nr_user_files = 0;
return ret;
}
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] io_uring: fix bad free in io_sqe_files_register
2019-04-21 1:42 ` [PATCH 1/1] " Dan Robertson
@ 2019-04-21 1:58 ` Jens Axboe
2019-04-21 2:02 ` Dan Robertson
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2019-04-21 1:58 UTC (permalink / raw)
To: Dan Robertson, linux-block
On 4/20/19 7:42 PM, Dan Robertson wrote:
> Given bad input to the io_uring_register syscall the io_ring_ctx
> user_files member is cleaned up in io_sqe_files_register, but a
> following call to io_uring_release will result in a double-free.
This was already fixed for -rc5 last week, in this commit:
commit 25adf50fe25d506d3fc12070a5ff4be858a1ac1b
Author: Jens Axboe <axboe@kernel.dk>
Date: Wed Apr 3 09:52:40 2019 -0600
io_uring: fix double free in case of fileset regitration failure
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] io_uring: fix bad free in io_sqe_files_register
2019-04-21 1:58 ` Jens Axboe
@ 2019-04-21 2:02 ` Dan Robertson
0 siblings, 0 replies; 4+ messages in thread
From: Dan Robertson @ 2019-04-21 2:02 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
Awesome! Sorry for the noise.
Cheers,
Dan
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-21 2:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-21 1:42 [PATCH 0/1] io_uring: fix bad free in io_sqe_files_register Dan Robertson
2019-04-21 1:42 ` [PATCH 1/1] " Dan Robertson
2019-04-21 1:58 ` Jens Axboe
2019-04-21 2:02 ` Dan Robertson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).