]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 11 Jan 2023 16:07:33 +0000 (17:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:09 +0000 (11:58 +0100)
commit00c522f3ddf198273b6552710770391fea5d808b
tree05fb4ad2ea5f61e5842ed2d7ba4cee20b0b1c398
parent4edb7cacbaa0a23f74d551958a1dc4d5f95de87b
netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits

commit 2fe73756e76752dbf8dd9cbabdd1b545714e3b58 upstream.

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: 937b9dbd0725 ("netfilter: nft_payload: add C-VLAN support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nft_payload.c