Skip to content

Commit 92e3b40

Browse files
Dan Carpentertytso
authored andcommitted
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 <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
1 parent 19ea806 commit 92e3b40

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/jbd2/transaction.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,13 @@ int jbd2_journal_start_reserved(handle_t *handle, unsigned int type,
514514
* similarly constrained call sites
515515
*/
516516
ret = start_this_handle(journal, handle, GFP_NOFS);
517-
if (ret < 0)
517+
if (ret < 0) {
518518
jbd2_journal_free_reserved(handle);
519+
return ret;
520+
}
519521
handle->h_type = type;
520522
handle->h_line_no = line_no;
521-
return ret;
523+
return 0;
522524
}
523525
EXPORT_SYMBOL(jbd2_journal_start_reserved);
524526

0 commit comments

Comments
 (0)