diff options
author | Andreas Wellving <andreas.wellving@enea.com> | 2018-10-12 15:49:44 +0200 |
---|---|---|
committer | Adrian Dudau <Adrian.Dudau@enea.com> | 2018-10-16 17:39:36 +0200 |
commit | 5c044f4e3ba6f258312bbcd0e2545bd972db02aa (patch) | |
tree | 61526ce91acf14497aa4852240de336511afd2b2 | |
parent | 5580db5bda636e69110ab0bf0733192bd1050fbc (diff) | |
download | enea-kernel-cache-5c044f4e3ba6f258312bbcd0e2545bd972db02aa.tar.gz |
ext4: CVE-2018-10881
ext4: clear i_data in ext4_inode_info when removing inline data
References:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6e8ab72a812396996035a37e5ca4b3b99b5d214b
Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
Change-Id: I1070aa3fee30f445dfad0b86fc12787f7f50235d
-rw-r--r-- | patches/cve/4.9.x.scc | 1 | ||||
-rw-r--r-- | patches/cve/CVE-2018-10881-ext4-clear-i_data-in-ext4_inode_info-when-removing-i.patch | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc index e5bf4ac..55c4591 100644 --- a/patches/cve/4.9.x.scc +++ b/patches/cve/4.9.x.scc | |||
@@ -31,4 +31,5 @@ patch CVE-2018-10876-ext4-only-look-at-the-bg_flags-field-if-it-is-valid.patch | |||
31 | patch CVE-2018-10877-ext4-verify-the-depth-of-extent-tree-in-ext4_find_ex.patch | 31 | patch CVE-2018-10877-ext4-verify-the-depth-of-extent-tree-in-ext4_find_ex.patch |
32 | patch CVE-2018-10878-ext4-always-check-block-group-bounds-in-ext4_init_bl.patch | 32 | patch CVE-2018-10878-ext4-always-check-block-group-bounds-in-ext4_init_bl.patch |
33 | patch CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch | 33 | patch CVE-2018-10879-ext4-make-sure-bitmaps-and-the-inode-table-don-t-ove.patch |
34 | patch CVE-2018-10881-ext4-clear-i_data-in-ext4_inode_info-when-removing-i.patch | ||
34 | 35 | ||
diff --git a/patches/cve/CVE-2018-10881-ext4-clear-i_data-in-ext4_inode_info-when-removing-i.patch b/patches/cve/CVE-2018-10881-ext4-clear-i_data-in-ext4_inode_info-when-removing-i.patch new file mode 100644 index 0000000..1abf375 --- /dev/null +++ b/patches/cve/CVE-2018-10881-ext4-clear-i_data-in-ext4_inode_info-when-removing-i.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From 6e8ab72a812396996035a37e5ca4b3b99b5d214b Mon Sep 17 00:00:00 2001 | ||
2 | From: Theodore Ts'o <tytso@mit.edu> | ||
3 | Date: Fri, 15 Jun 2018 12:28:16 -0400 | ||
4 | Subject: [PATCH] ext4: clear i_data in ext4_inode_info when removing inline | ||
5 | data | ||
6 | |||
7 | When converting from an inode from storing the data in-line to a data | ||
8 | block, ext4_destroy_inline_data_nolock() was only clearing the on-disk | ||
9 | copy of the i_blocks[] array. It was not clearing copy of the | ||
10 | i_blocks[] in ext4_inode_info, in i_data[], which is the copy actually | ||
11 | used by ext4_map_blocks(). | ||
12 | |||
13 | This didn't matter much if we are using extents, since the extents | ||
14 | header would be invalid and thus the extents could would re-initialize | ||
15 | the extents tree. But if we are using indirect blocks, the previous | ||
16 | contents of the i_blocks array will be treated as block numbers, with | ||
17 | potentially catastrophic results to the file system integrity and/or | ||
18 | user data. | ||
19 | |||
20 | This gets worse if the file system is using a 1k block size and | ||
21 | s_first_data is zero, but even without this, the file system can get | ||
22 | quite badly corrupted. | ||
23 | |||
24 | This addresses CVE-2018-10881. | ||
25 | Upstream-Status: Backport | ||
26 | |||
27 | https://bugzilla.kernel.org/show_bug.cgi?id=200015 | ||
28 | |||
29 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
30 | Cc: stable@kernel.org | ||
31 | Signed-off-by: Andreas Wellving <andreas.wellving@enea.com> | ||
32 | --- | ||
33 | fs/ext4/inline.c | 1 + | ||
34 | 1 file changed, 1 insertion(+) | ||
35 | |||
36 | diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c | ||
37 | index 44b4fcd..d79115d 100644 | ||
38 | --- a/fs/ext4/inline.c | ||
39 | +++ b/fs/ext4/inline.c | ||
40 | @@ -437,6 +437,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle, | ||
41 | |||
42 | memset((void *)ext4_raw_inode(&is.iloc)->i_block, | ||
43 | 0, EXT4_MIN_INLINE_DATA_SIZE); | ||
44 | + memset(ei->i_data, 0, EXT4_MIN_INLINE_DATA_SIZE); | ||
45 | |||
46 | if (ext4_has_feature_extents(inode->i_sb)) { | ||
47 | if (S_ISDIR(inode->i_mode) || | ||
48 | -- | ||
49 | |||
50 | |||