From: Jens Axboe Date: Thu, 24 Sep 2020 20:55:54 +0000 (-0600) Subject: io_uring: ensure open/openat2 name is cleaned on cancelation X-Git-Tag: v5.8.13~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3bd50397031b6a7bef33a071eb619dcb1b6d0a26;p=thirdparty%2Fkernel%2Fstable.git io_uring: ensure open/openat2 name is cleaned on cancelation commit f3cd4850504ff612d0ea77a0aaf29b66c98fcefe upstream. If we cancel these requests, we'll leak the memory associated with the filename. Add them to the table of ops that need cleaning, if REQ_F_NEED_CLEANUP is set. Cc: stable@vger.kernel.org Fixes: e62753e4e292 ("io_uring: call statx directly") Reviewed-by: Stefano Garzarella Signed-off-by: Jens Axboe Signed-off-by: Stefano Garzarella Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 849e39c3cfcd7..1d5640cc2a488 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5254,6 +5254,8 @@ static void io_cleanup_req(struct io_kiocb *req) break; case IORING_OP_OPENAT: case IORING_OP_OPENAT2: + if (req->open.filename) + putname(req->open.filename); break; case IORING_OP_SPLICE: case IORING_OP_TEE: