diff mbox series

[1/1] io_uring: fix bad free in io_sqe_files_register

Message ID 20190421014245.17652-2-dan@dlrobertson.com (mailing list archive)
State New, archived
Headers show
Series io_uring: fix bad free in io_sqe_files_register | expand

Commit Message

Dan Robertson April 21, 2019, 1:42 a.m. UTC
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 mbox series

Patch

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;
 	}