From: Jens Axboe <axboe@xxxxxxxxx> [ Upstream commit f3cd4850504ff612d0ea77a0aaf29b66c98fcefe ] 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@xxxxxxxxxxxxxxx Fixes: e62753e4e292 ("io_uring: call statx directly") Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx> --- fs/io_uring.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index d05023ca74bd..864341445926 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5252,6 +5252,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: -- 2.26.2