Skip to content

Commit

Permalink
jbd2: don't mark block as modified if the handle is out of credits
Browse files Browse the repository at this point in the history
commit e09463f220ca9a1a1ecfda84fcda658f99a1f12a upstream.

Do not set the b_modified flag in block's journal head should not
until after we're sure that jbd2_journal_dirty_metadat() will not
abort with an error due to there not being enough space reserved in
the jbd2 handle.

Otherwise, future attempts to modify the buffer may lead a large
number of spurious errors and warnings.

This addresses CVE-2018-10883.

https://bugzilla.kernel.org/show_bug.cgi?id=200071

Change-Id: Icfc6d728edc1da69900544ba60a9c57575b5bd7f
Signed-off-by: Theodore Ts'o <[email protected]>
[bwh: Backported to 3.16: Drop the added logging statement, as it's on
 a code path that doesn't exist here]
Signed-off-by: Ben Hutchings <[email protected]>
  • Loading branch information
tytso authored and adithya2306 committed Nov 7, 2018
1 parent a58c57b commit 4cff4cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/jbd2/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,11 +1150,11 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
* of the transaction. This needs to be done
* once a transaction -bzzz
*/
jh->b_modified = 1;
if (handle->h_buffer_credits <= 0) {
ret = -ENOSPC;
goto out_unlock_bh;
}
jh->b_modified = 1;
handle->h_buffer_credits--;
}

Expand Down

0 comments on commit 4cff4cd

Please sign in to comment.