diff --git a/fs/io_uring.c b/fs/io_uring.c index 5a45da2b87e958ea2dafea2e6a28d9e6edabe3b9..23635ca4546d4dff6a429379ea1318fed1a0a9a4 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2657,8 +2657,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock) } } out_free: - kfree(iovec); - req->flags &= ~REQ_F_NEED_CLEANUP; + if (!(req->flags & REQ_F_NEED_CLEANUP)) + kfree(iovec); return ret; } @@ -2780,8 +2780,8 @@ static int io_write(struct io_kiocb *req, bool force_nonblock) } } out_free: - req->flags &= ~REQ_F_NEED_CLEANUP; - kfree(iovec); + if (!(req->flags & REQ_F_NEED_CLEANUP)) + kfree(iovec); return ret; }