Blame SOURCES/CVE-2022-34918.patch

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