From: Dan Carpenter Date: Tue, 18 Feb 2014 01:33:01 +0000 (-0500) Subject: jbd2: fix use after free in jbd2_journal_start_reserved() X-Git-Tag: submit/tizen/20160607.132125~4830^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92e3b40537707001d17bbad800d150ab04e53bf4;p=sdk%2Femulator%2Femulator-kernel.git jbd2: fix use after free in jbd2_journal_start_reserved() If start_this_handle() fails then it leads to a use after free of "handle". Signed-off-by: Dan Carpenter Signed-off-by: "Theodore Ts'o" Cc: stable@vger.kernel.org --- diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 8360674..60bb365 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -514,11 +514,13 @@ int jbd2_journal_start_reserved(handle_t *handle, unsigned int type, * similarly constrained call sites */ ret = start_this_handle(journal, handle, GFP_NOFS); - if (ret < 0) + if (ret < 0) { jbd2_journal_free_reserved(handle); + return ret; + } handle->h_type = type; handle->h_line_no = line_no; - return ret; + return 0; } EXPORT_SYMBOL(jbd2_journal_start_reserved);