Skip to contentSkip to conversation

jbd2: use after free in jbd2_journal_start_reserved()

PATCH Applied Dan Carpenter 2 participants 2 messages Feb 13, 2014 – Feb 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jbd2: use after free in jbd2_journal_start_reserved()

If start_this_handle() fails then it leads to a use after free of "handle".

fs/jbd2/transaction.c +4 -2
index 8360674c85bc..60bb365f54a5 100644
@@ -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);