Blame SOURCES/CVE-2021-33909.patch

040390
From 867b652db42ff8fa41b3c25e7ef9df48003ea4eb Mon Sep 17 00:00:00 2001
040390
From: Joe Lawrence <joe.lawrence@redhat.com>
040390
Date: Tue, 6 Jul 2021 13:18:41 -0400
040390
Subject: [PATCH] seq_files: kpatch fix for CVE-2021-33909
040390
040390
Kernels:
040390
4.18.0-305.el8
040390
4.18.0-305.3.1.el8_4
040390
4.18.0-305.7.1.el8_4
040390
040390
Changes since last build:
040390
[x86_64]:
040390
seq_file.o: changed function: seq_read
040390
seq_file.o: changed function: single_open_size
040390
seq_file.o: changed function: traverse
040390
040390
[ppc64le]:
040390
seq_file.o: changed function: seq_read
040390
seq_file.o: changed function: single_open_size
040390
seq_file.o: changed function: traverse.part.4
040390
040390
---------------------------
040390
040390
Kernels:
040390
4.18.0-305.el8
040390
4.18.0-305.3.1.el8_4
040390
4.18.0-305.7.1.el8_4
040390
040390
Modifications: none
040390
040390
commit 217fcaff73c6916b817280df9310852192026615
040390
Author: Ian Kent <ikent@redhat.com>
040390
Date:   Thu Jul 1 08:10:39 2021 +0800
040390
040390
    seq_file: Disallow extremely large seq buffer allocations
040390
040390
    Bugzilla: https://bugzilla.redhat.com/1975181
040390
    CVE: CVE-2021-33909
040390
    Y-Commit: 61d17175cddbac1f305c2704b336c9119b71bbfe
040390
040390
    O-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1975182
040390
    Brew build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=37831839
040390
    Testing: The patch has been tested by Qualys and it has been
040390
             confirmed the patch fixes the problem.
040390
    Upstream status: RHEL only (CVE-2021-33909)
040390
040390
    Author: Eric Sandeen <sandeen@redhat.com>
040390
040390
    seq_file: Disallow extremely large seq buffer allocations
040390
040390
    There is no reasonable need for a buffer larger than this,
040390
    and it avoids int overflow pitfalls.
040390
040390
    Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
040390
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
040390
040390
    Signed-off-by: Ian Kent <ikent@redhat.com>
040390
    Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
040390
040390
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
040390
Acked-by: Yannick Cote <ycote@redhat.com>
040390
Acked-by: Artem Savkov <asavkov@redhat.com>
040390
---
040390
 fs/seq_file.c | 3 +++
040390
 1 file changed, 3 insertions(+)
040390
040390
diff --git a/fs/seq_file.c b/fs/seq_file.c
040390
index 1600034a929bb1..c19ecc1f2d5023 100644
040390
--- a/fs/seq_file.c
040390
+++ b/fs/seq_file.c
040390
@@ -29,6 +29,9 @@ static void seq_set_overflow(struct seq_file *m)
040390
 
040390
 static void *seq_buf_alloc(unsigned long size)
040390
 {
040390
+	if (unlikely(size > MAX_RW_COUNT))
040390
+		return NULL;
040390
+
040390
 	return kvmalloc(size, GFP_KERNEL_ACCOUNT);
040390
 }
040390
 
040390
-- 
040390
2.26.3
040390