From: Dan Robertson <dan@dlrobertson.com>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Dan Robertson <dan@dlrobertson.com>
Subject: [PATCH 1/1] io_uring: fix bad free in io_sqe_files_register
Date: Sun, 21 Apr 2019 01:42:45 +0000 [thread overview]
Message-ID: <20190421014245.17652-2-dan@dlrobertson.com> (raw)
In-Reply-To: <20190421014245.17652-1-dan@dlrobertson.com>
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
next prev parent reply other threads:[~2019-04-21 2:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2019-04-21 1:58 ` [PATCH 1/1] " Jens Axboe
2019-04-21 2:02 ` Dan Robertson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190421014245.17652-2-dan@dlrobertson.com \
--to=dan@dlrobertson.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).