Blame SOURCES/CVE-2021-33909.patch

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