Blame SOURCES/CVE-2022-34918.patch

aa804e
From 4dbabad13fa5c506138d15506f220006cde28d30 Mon Sep 17 00:00:00 2001
aa804e
From: Linqing Lu <lilu@redhat.com>
aa804e
Date: Thu, 4 Aug 2022 16:36:13 -0400
aa804e
Subject: [KPATCH CVE-2022-34918] kpatch fixes for CVE-2022-34918
aa804e
aa804e
Kernels:
aa804e
5.14.0-70.13.1.el9_0
aa804e
5.14.0-70.17.1.el9_0
aa804e
aa804e
aa804e
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-9/-/merge_requests/4
aa804e
Approved-by: Joe Lawrence (@joe.lawrence)
aa804e
Changes since last build:
aa804e
arches: x86_64 ppc64le
aa804e
nf_tables_api.o: changed function: nft_add_set_elem
aa804e
---------------------------
aa804e
aa804e
Modifications: none
aa804e
aa804e
commit 6fd61750c2355e23d4cb1b1d9de297b884076a06
aa804e
Author: Florian Westphal <fwestpha@redhat.com>
aa804e
Date:   Mon Jul 4 08:12:40 2022 +0200
aa804e
aa804e
    netfilter: nf_tables: stricter validation of element data
aa804e
aa804e
    Bugzilla: https://bugzilla.redhat.com/2104591
aa804e
    CVE: CVE-2022-34918
aa804e
    Y-Commit: 42087f51a09378ae5fa93d3bea82b4883f983e57
aa804e
aa804e
    O-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2104592
aa804e
    Upstream Status: commit 7e6bc1f6cabc
aa804e
    O-CVE: CVE-2022-34918
aa804e
aa804e
    commit 7e6bc1f6cabcd30aba0b11219d8e01b952eacbb6
aa804e
    Author: Pablo Neira Ayuso <pablo@netfilter.org>
aa804e
    Date:   Sat Jul 2 04:16:30 2022 +0200
aa804e
aa804e
        netfilter: nf_tables: stricter validation of element data
aa804e
aa804e
        Make sure element data type and length do not mismatch the one specified
aa804e
        by the set declaration.
aa804e
aa804e
        Fixes: 7d7402642eaf ("netfilter: nf_tables: variable sized set element keys / data")
aa804e
        Reported-by: Hugues ANGUELKOV <hanguelkov@randorisec.fr>
aa804e
        Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
aa804e
aa804e
    Signed-off-by: Florian Westphal <fwestpha@redhat.com>
aa804e
    Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
aa804e
aa804e
Signed-off-by: Linqing Lu <lilu@redhat.com>
aa804e
---
aa804e
 net/netfilter/nf_tables_api.c | 9 ++++++++-
aa804e
 1 file changed, 8 insertions(+), 1 deletion(-)
aa804e
aa804e
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
aa804e
index d495e10044dc..741a4e937e6f 100644
aa804e
--- a/net/netfilter/nf_tables_api.c
aa804e
+++ b/net/netfilter/nf_tables_api.c
aa804e
@@ -5094,13 +5094,20 @@ static int nft_setelem_parse_data(struct nft_ctx *ctx, struct nft_set *set,
aa804e
 				  struct nft_data *data,
aa804e
 				  struct nlattr *attr)
aa804e
 {
aa804e
+	u32 dtype;
aa804e
 	int err;
aa804e
 
aa804e
 	err = nft_data_init(ctx, data, NFT_DATA_VALUE_MAXLEN, desc, attr);
aa804e
 	if (err < 0)
aa804e
 		return err;
aa804e
 
aa804e
-	if (desc->type != NFT_DATA_VERDICT && desc->len != set->dlen) {
aa804e
+	if (set->dtype == NFT_DATA_VERDICT)
aa804e
+		dtype = NFT_DATA_VERDICT;
aa804e
+	else
aa804e
+		dtype = NFT_DATA_VALUE;
aa804e
+
aa804e
+	if (dtype != desc->type ||
aa804e
+	    set->dlen != desc->len) {
aa804e
 		nft_data_release(data, desc->type);
aa804e
 		return -EINVAL;
aa804e
 	}
aa804e
-- 
aa804e
2.37.2
aa804e
aa804e