From 8552f3231628950fb3f2a8966ef78b14006aefb2 Mon Sep 17 00:00:00 2001
From: Ryan Sullivan <rysulliv@redhat.com>
Date: Tue, 31 Jan 2023 11:26:03 -0500
Subject: [KPATCH CVE-2023-0179] kpatch fixes for CVE-2023-0179
Kernels:
5.14.0-162.6.1.el9_1
5.14.0-162.12.1.el9_1
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-9/-/merge_requests/23
Approved-by: Yannick Cote (@ycote1)
Approved-by: Joe Lawrence (@joe.lawrence)
Changes since last build:
arches: x86_64 ppc64le
l2cap_core.o: changed function: l2cap_rx_state_recv
l2cap_core.o: changed function: l2cap_stream_rx
nfs4proc.o: changed function: nfsd4_copy
nfs4proc.o: changed function: nfsd4_do_async_copy
nft_payload.o: changed function: nft_payload_copy_vlan
sysctl.o: changed function: __do_proc_dointvec
sysctl.o: changed function: __do_proc_douintvec
sysctl.o: changed function: __do_proc_doulongvec_minmax
sysctl.o: changed function: proc_get_long.constprop.0
---------------------------
Modifications: none
commit d4b9787a8f8c75d0c37560d25e817183a700fbec
Author: Florian Westphal <fwestpha@redhat.com>
Date: Tue Jan 17 19:28:09 2023 +0100
netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits
Bugzilla: https://bugzilla.redhat.com/2161724
CVE: CVE-2023-0179
Y-Commit: c3747b9b25ff4bfdc9fa5c139126043fc8c0389c
O-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2161725
Upstream Status: net commit 696e1a48b1a1b
O-CVE: CVE-2023-0179
commit 696e1a48b1a1b01edad542a1ef293665864a4dd0
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Wed Jan 11 17:07:33 2023 +0100
netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits
If the offset + length goes over the ethernet + vlan header, then the
length is adjusted to copy the bytes that are within the boundaries of
the vlan_ethhdr scratchpad area. The remaining bytes beyond ethernet +
vlan header are copied directly from the skbuff data area.
Fix incorrect arithmetic operator: subtract, not add, the size of the
vlan header in case of double-tagged packets to adjust the length
accordingly to address CVE-2023-0179.
Reported-by: Davide Ornaghi <d.ornaghi97@gmail.com>
Fixes: f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fwestpha@redhat.com>
Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
Signed-off-by: Ryan Sullivan <rysulliv@redhat.com>
---
net/netfilter/nft_payload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 9af0d58a33f4..ee603dc05e81 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -62,7 +62,7 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)
return false;
if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
- ethlen -= offset + len - VLAN_ETH_HLEN + vlan_hlen;
+ ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
--
2.39.1