summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--patches/cve/CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch51
1 files changed, 51 insertions, 0 deletions
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..f685d4e
--- /dev/null
+++ b/patches/cve/CVE-2018-1092-ext4-fail-ext4_iget-for-root-directory-if-unallocate.patch
@@ -0,0 +1,51 @@
1From 8e0e94683f8449f4e83b4b563b80eb9c76b9e18f Mon Sep 17 00:00:00 2001
2From: Theodore Ts'o <tytso@mit.edu>
3Date: Thu, 29 Mar 2018 21:56:09 -0400
4Subject: [PATCH] ext4: fail ext4_iget for root directory if unallocated
5
6commit 8e4b5eae5decd9dfe5a4ee369c22028f90ab4c44 upstream.
7
8If the root directory has an i_links_count of zero, then when the file
9system is mounted, then when ext4_fill_super() notices the problem and
10tries to call iput() the root directory in the error return path,
11ext4_evict_inode() will try to free the inode on disk, before all of
12the file system structures are set up, and this will result in an OOPS
13caused by a NULL pointer dereference.
14
15This issue has been assigned CVE-2018-1092.
16
17https://bugzilla.kernel.org/show_bug.cgi?id=199179
18https://bugzilla.redhat.com/show_bug.cgi?id=1560777
19
20CVE: CVE-2018-1092
21Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=8e0e94683f8449f4e83b4b563b80eb9c76b9e18f]
22
23Reported-by: Wen Xu <wen.xu@gatech.edu>
24Signed-off-by: Theodore Ts'o <tytso@mit.edu>
25Cc: stable@vger.kernel.org
26Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
28---
29 fs/ext4/inode.c | 6 ++++++
30 1 file changed, 6 insertions(+)
31
32diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
33index 69f017e88e89..09014c3c4207 100644
34--- a/fs/ext4/inode.c
35+++ b/fs/ext4/inode.c
36@@ -4685,6 +4685,12 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
37 goto bad_inode;
38 raw_inode = ext4_raw_inode(&iloc);
39
40+ if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) {
41+ EXT4_ERROR_INODE(inode, "root inode unallocated");
42+ ret = -EFSCORRUPTED;
43+ goto bad_inode;
44+ }
45+
46 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
47 ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
48 if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
49--
502.20.1
51