Skip to content

Commit

Permalink
jbd2: fix use after free in jbd2_journal_start_reserved()
Browse files Browse the repository at this point in the history
If start_this_handle() fails then it leads to a use after free of
"handle".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
  • Loading branch information
Dan Carpenter authored and tytso committed Feb 18, 2014
1 parent 19ea806 commit 92e3b40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/jbd2/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 92e3b40

Please sign in to comment.