diff options
author | Andreas Wellving <andreas.wellving@enea.com> | 2018-10-12 10:02:31 +0200 |
---|---|---|
committer | Adrian Dudau <Adrian.Dudau@enea.com> | 2018-10-16 17:34:14 +0200 |
commit | 70d96b74d700846ca3454a406629edff6f9edc04 (patch) | |
tree | 219593b44c5bed3f1ede36e5130028b48054568c | |
parent | 5590d516e5d8c7c1066f28e84d91d861e250a42c (diff) | |
download | enea-kernel-cache-70d96b74d700846ca3454a406629edff6f9edc04.tar.gz |
ext4: CVE-2018-1092
ext4: fail ext4_iget for root directory if unallocated
References:
https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?id=8e4b5eae5decd9dfe5a4ee369c22028f90ab4c44
Change-Id: If2dd6fd5735e5e0e3282342dec93342f6b2c0943
Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r-- | patches/cve/4.9.x.scc | 3 | ||||
-rw-r--r-- | patches/cve/CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch | 48 |
2 files changed, 51 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc index 3fa8213..4b6ec00 100644 --- a/patches/cve/4.9.x.scc +++ b/patches/cve/4.9.x.scc | |||
@@ -11,3 +11,6 @@ patch CVE-2018-7480-blkcg-fix-double-free-of-new_blkg-in-blkcg_init_queu.patch | |||
11 | 11 | ||
12 | #CVEs fixed in 4.9.92: | 12 | #CVEs fixed in 4.9.92: |
13 | patch CVE-2018-1130-dccp-check-sk-for-closed-state-in-dccp_sendmsg.patch | 13 | patch CVE-2018-1130-dccp-check-sk-for-closed-state-in-dccp_sendmsg.patch |
14 | |||
15 | #CVEs fixed in 4.9.96: | ||
16 | patch CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch | ||
diff --git a/patches/cve/CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch b/patches/cve/CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch new file mode 100644 index 0000000..5d1d8dc --- /dev/null +++ b/patches/cve/CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From 8e4b5eae5decd9dfe5a4ee369c22028f90ab4c44 Mon Sep 17 00:00:00 2001 | ||
2 | From: Theodore Ts'o <tytso@mit.edu> | ||
3 | Date: Thu, 29 Mar 2018 21:56:09 -0400 | ||
4 | Subject: [PATCH] ext4: fail ext4_iget for root directory if unallocated | ||
5 | |||
6 | If the root directory has an i_links_count of zero, then when the file | ||
7 | system is mounted, then when ext4_fill_super() notices the problem and | ||
8 | tries to call iput() the root directory in the error return path, | ||
9 | ext4_evict_inode() will try to free the inode on disk, before all of | ||
10 | the file system structures are set up, and this will result in an OOPS | ||
11 | caused by a NULL pointer dereference. | ||
12 | |||
13 | This issue has been assigned CVE-2018-1092. | ||
14 | |||
15 | https://bugzilla.kernel.org/show_bug.cgi?id=199179 | ||
16 | https://bugzilla.redhat.com/show_bug.cgi?id=1560777 | ||
17 | |||
18 | CVE: CVE-2018-1092 | ||
19 | Upstream-Status: Backport | ||
20 | |||
21 | Reported-by: Wen Xu <wen.xu@gatech.edu> | ||
22 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
23 | Cc: stable@vger.kernel.org | ||
24 | Signed-off-by: Andreas Wellving <andreas.wellving@enea.com> | ||
25 | --- | ||
26 | fs/ext4/inode.c | 6 ++++++ | ||
27 | 1 file changed, 6 insertions(+) | ||
28 | |||
29 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c | ||
30 | index 4359655..18aa2ef 100644 | ||
31 | --- a/fs/ext4/inode.c | ||
32 | +++ b/fs/ext4/inode.c | ||
33 | @@ -4732,6 +4732,12 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | ||
34 | goto bad_inode; | ||
35 | raw_inode = ext4_raw_inode(&iloc); | ||
36 | |||
37 | + if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) { | ||
38 | + EXT4_ERROR_INODE(inode, "root inode unallocated"); | ||
39 | + ret = -EFSCORRUPTED; | ||
40 | + goto bad_inode; | ||
41 | + } | ||
42 | + | ||
43 | if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) { | ||
44 | ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize); | ||
45 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > | ||
46 | -- | ||
47 | |||
48 | |||