From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin LaHaise Subject: [PATCH 2/2] aio: fix potential leak in aio_run_iocb(). Date: Thu, 1 May 2014 09:07:09 -0400 Message-ID: <20140501130709.GL28959@kvack.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, stable@vger.kernel.org, Leon Yu To: torvalds@linux-foundation.org Return-path: Content-Disposition: inline In-Reply-To: Sender: owner-linux-aio@kvack.org List-Id: linux-fsdevel.vger.kernel.org iovec should be reclaimed whenever caller of rw_copy_check_uvector() returns, but it doesn't hold when failure happens right after aio_setup_vectored_rw(). Fix that in a such way to avoid hairy goto. Signed-off-by: Leon Yu Signed-off-by: Benjamin LaHaise Cc: stable@vger.kernel.org --- fs/aio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 2adbb03..a0ed6c7 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1327,10 +1327,8 @@ rw_common: &iovec, compat) : aio_setup_single_vector(req, rw, buf, &nr_segs, iovec); - if (ret) - return ret; - - ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); + if (!ret) + ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); if (ret < 0) { if (iovec != &inline_vec) kfree(iovec); -- 1.8.2.1 -- "Thought is the essence of where you are now." -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: aart@kvack.org