summaryrefslogtreecommitdiffstats
path: root/patches/cve/CVE-2018-14617-hfsplus-fix-NULL-dereference-in-hfsplus_lookup.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/cve/CVE-2018-14617-hfsplus-fix-NULL-dereference-in-hfsplus_lookup.patch')
-rw-r--r--patches/cve/CVE-2018-14617-hfsplus-fix-NULL-dereference-in-hfsplus_lookup.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/patches/cve/CVE-2018-14617-hfsplus-fix-NULL-dereference-in-hfsplus_lookup.patch b/patches/cve/CVE-2018-14617-hfsplus-fix-NULL-dereference-in-hfsplus_lookup.patch
new file mode 100644
index 0000000..a9ad131
--- /dev/null
+++ b/patches/cve/CVE-2018-14617-hfsplus-fix-NULL-dereference-in-hfsplus_lookup.patch
@@ -0,0 +1,64 @@
1From 68e787c3c80059c776d1d7afb20f5eb9f20237a5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Ernesto=20A=2E=20Fern=C3=A1ndez?=
3 <ernesto.mnd.fernandez@gmail.com>
4Date: Thu, 23 Aug 2018 17:00:25 -0700
5Subject: [PATCH] hfsplus: fix NULL dereference in hfsplus_lookup()
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10[ Upstream commit a7ec7a4193a2eb3b5341243fc0b621c1ac9e4ec4 ]
11
12An HFS+ filesystem can be mounted read-only without having a metadata
13directory, which is needed to support hardlinks. But if the catalog
14data is corrupted, a directory lookup may still find dentries claiming
15to be hardlinks.
16
17hfsplus_lookup() does check that ->hidden_dir is not NULL in such a
18situation, but mistakenly does so after dereferencing it for the first
19time. Reorder this check to prevent a crash.
20
21This happens when looking up corrupted catalog data (dentry) on a
22filesystem with no metadata directory (this could only ever happen on a
23read-only mount). Wen Xu sent the replication steps in detail to the
24fsdevel list: https://bugzilla.kernel.org/show_bug.cgi?id=200297
25
26CVE: CVE-2018-14617
27Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=68e787c3c80059c776d1d7afb20f5eb9f20237a5]
28
29Link: http://lkml.kernel.org/r/20180712215344.q44dyrhymm4ajkao@eaf
30Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
31Reported-by: Wen Xu <wen.xu@gatech.edu>
32Cc: Viacheslav Dubeyko <slava@dubeyko.com>
33Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
34Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
35Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
36Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
38---
39 fs/hfsplus/dir.c | 4 ++--
40 1 file changed, 2 insertions(+), 2 deletions(-)
41
42diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
43index e8120a282435..1a44c4621e74 100644
44--- a/fs/hfsplus/dir.c
45+++ b/fs/hfsplus/dir.c
46@@ -78,13 +78,13 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,
47 cpu_to_be32(HFSP_HARDLINK_TYPE) &&
48 entry.file.user_info.fdCreator ==
49 cpu_to_be32(HFSP_HFSPLUS_CREATOR) &&
50+ HFSPLUS_SB(sb)->hidden_dir &&
51 (entry.file.create_date ==
52 HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)->
53 create_date ||
54 entry.file.create_date ==
55 HFSPLUS_I(d_inode(sb->s_root))->
56- create_date) &&
57- HFSPLUS_SB(sb)->hidden_dir) {
58+ create_date)) {
59 struct qstr str;
60 char name[32];
61
62--
632.20.1
64