diff options
Diffstat (limited to 'meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2019-5188.patch')
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2019-5188.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2019-5188.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2019-5188.patch new file mode 100644 index 0000000000..de4bce0037 --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/CVE-2019-5188.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From 8dd73c149f418238f19791f9d666089ef9734dff Mon Sep 17 00:00:00 2001 | ||
2 | From: Theodore Ts'o <tytso@mit.edu> | ||
3 | Date: Thu, 19 Dec 2019 19:37:34 -0500 | ||
4 | Subject: [PATCH] e2fsck: abort if there is a corrupted directory block when | ||
5 | rehashing | ||
6 | |||
7 | In e2fsck pass 3a, when we are rehashing directories, at least in | ||
8 | theory, all of the directories should have had corruptions with | ||
9 | respect to directory entry structure fixed. However, it's possible | ||
10 | (for example, if the user declined a fix) that we can reach this stage | ||
11 | of processing with a corrupted directory entries. | ||
12 | |||
13 | So check for that case and don't try to process a corrupted directory | ||
14 | block so we don't run into trouble in mutate_name() if there is a | ||
15 | zero-length file name. | ||
16 | |||
17 | Addresses: TALOS-2019-0973 | ||
18 | Addresses: CVE-2019-5188 | ||
19 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
20 | |||
21 | CVE: CVE-2019-5188 | ||
22 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
23 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=8dd73c149f418238f19791f9d666089ef9734dff] | ||
24 | --- | ||
25 | e2fsck/rehash.c | 9 +++++++++ | ||
26 | 1 file changed, 9 insertions(+) | ||
27 | |||
28 | diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c | ||
29 | index a5fc1be1..3dd1e941 100644 | ||
30 | --- a/e2fsck/rehash.c | ||
31 | +++ b/e2fsck/rehash.c | ||
32 | @@ -160,6 +160,10 @@ static int fill_dir_block(ext2_filsys fs, | ||
33 | dir_offset += rec_len; | ||
34 | if (dirent->inode == 0) | ||
35 | continue; | ||
36 | + if ((name_len) == 0) { | ||
37 | + fd->err = EXT2_ET_DIR_CORRUPTED; | ||
38 | + return BLOCK_ABORT; | ||
39 | + } | ||
40 | if (!fd->compress && (name_len == 1) && | ||
41 | (dirent->name[0] == '.')) | ||
42 | continue; | ||
43 | @@ -401,6 +405,11 @@ static int duplicate_search_and_fix(e2fsck_t ctx, ext2_filsys fs, | ||
44 | continue; | ||
45 | } | ||
46 | new_len = ext2fs_dirent_name_len(ent->dir); | ||
47 | + if (new_len == 0) { | ||
48 | + /* should never happen */ | ||
49 | + ext2fs_unmark_valid(fs); | ||
50 | + continue; | ||
51 | + } | ||
52 | memcpy(new_name, ent->dir->name, new_len); | ||
53 | mutate_name(new_name, &new_len); | ||
54 | for (j=0; j < fd->num_array; j++) { | ||
55 | -- | ||
56 | 2.24.1 | ||
57 | |||