summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--patches/cve/CVE-2018-10883-jbd2-don-t-mark-block-as-modified-if-the-handle-is-o.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/patches/cve/CVE-2018-10883-jbd2-don-t-mark-block-as-modified-if-the-handle-is-o.patch b/patches/cve/CVE-2018-10883-jbd2-don-t-mark-block-as-modified-if-the-handle-is-o.patch
new file mode 100644
index 0000000..d69548e
--- /dev/null
+++ b/patches/cve/CVE-2018-10883-jbd2-don-t-mark-block-as-modified-if-the-handle-is-o.patch
@@ -0,0 +1,65 @@
1From 0321e68838d7ba2528b367b879b2fcf9d96a2099 Mon Sep 17 00:00:00 2001
2From: Theodore Ts'o <tytso@mit.edu>
3Date: Sat, 16 Jun 2018 20:21:45 -0400
4Subject: [PATCH] jbd2: don't mark block as modified if the handle is out of
5 credits
6
7commit e09463f220ca9a1a1ecfda84fcda658f99a1f12a upstream.
8
9Do not set the b_modified flag in block's journal head should not
10until after we're sure that jbd2_journal_dirty_metadat() will not
11abort with an error due to there not being enough space reserved in
12the jbd2 handle.
13
14Otherwise, future attempts to modify the buffer may lead a large
15number of spurious errors and warnings.
16
17This addresses CVE-2018-10883.
18
19https://bugzilla.kernel.org/show_bug.cgi?id=200071
20
21CVE: CVE-2018-10883
22Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=0321e68838d7ba2528b367b879b2fcf9d96a2099]
23
24Signed-off-by: Theodore Ts'o <tytso@mit.edu>
25Cc: stable@kernel.org
26Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
28---
29 fs/jbd2/transaction.c | 9 ++++++++-
30 1 file changed, 8 insertions(+), 1 deletion(-)
31
32diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
33index 07793e25c976..e42736c1fdc8 100644
34--- a/fs/jbd2/transaction.c
35+++ b/fs/jbd2/transaction.c
36@@ -1366,6 +1366,13 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
37 if (jh->b_transaction == transaction &&
38 jh->b_jlist != BJ_Metadata) {
39 jbd_lock_bh_state(bh);
40+ if (jh->b_transaction == transaction &&
41+ jh->b_jlist != BJ_Metadata)
42+ pr_err("JBD2: assertion failure: h_type=%u "
43+ "h_line_no=%u block_no=%llu jlist=%u\n",
44+ handle->h_type, handle->h_line_no,
45+ (unsigned long long) bh->b_blocknr,
46+ jh->b_jlist);
47 J_ASSERT_JH(jh, jh->b_transaction != transaction ||
48 jh->b_jlist == BJ_Metadata);
49 jbd_unlock_bh_state(bh);
50@@ -1385,11 +1392,11 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
51 * of the transaction. This needs to be done
52 * once a transaction -bzzz
53 */
54- jh->b_modified = 1;
55 if (handle->h_buffer_credits <= 0) {
56 ret = -ENOSPC;
57 goto out_unlock_bh;
58 }
59+ jh->b_modified = 1;
60 handle->h_buffer_credits--;
61 }
62
63--
642.20.1
65