io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.8] io_uring: ensure open/openat2 name is cleaned on cancelation
@ 2020-09-28 15:35 Stefano Garzarella
  2020-09-28 17:33 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Garzarella @ 2020-09-28 15:35 UTC (permalink / raw)
  To: stable; +Cc: gregkh, io-uring, axboe

From: Jens Axboe <axboe@kernel.dk>

[ 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@vger.kernel.org
Fixes: e62753e4e292 ("io_uring: call statx directly")
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 5.8] io_uring: ensure open/openat2 name is cleaned on cancelation
  2020-09-28 15:35 [PATCH 5.8] io_uring: ensure open/openat2 name is cleaned on cancelation Stefano Garzarella
@ 2020-09-28 17:33 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2020-09-28 17:33 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: stable, io-uring, axboe

On Mon, Sep 28, 2020 at 05:35:07PM +0200, Stefano Garzarella wrote:
> From: Jens Axboe <axboe@kernel.dk>
> 
> [ 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@vger.kernel.org
> Fixes: e62753e4e292 ("io_uring: call statx directly")
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>  fs/io_uring.c | 2 ++
>  1 file changed, 2 insertions(+)

Thanks, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-28 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 15:35 [PATCH 5.8] io_uring: ensure open/openat2 name is cleaned on cancelation Stefano Garzarella
2020-09-28 17:33 ` Greg KH

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).