netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 26 Jun 2024 21:15:38 +0000 (23:15 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 26 Jun 2024 23:09:51 +0000 (01:09 +0200)
commit7931d32955e09d0a11b1fe0b6aac1bfa061c005c
treecfe86b94022cfea0817cace978248e94aeb93892
parentaef5daa2c49d510436b733827d4f0bab79fcc4a0
netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers

register store validation for NFT_DATA_VALUE is conditional, however,
the datatype is always either NFT_DATA_VALUE or NFT_DATA_VERDICT. This
only requires a new helper function to infer the register type from the
set datatype so this conditional check can be removed. Otherwise,
pointer to chain object can be leaked through the registers.

Fixes: 96518518cc41 ("netfilter: add nftables")
Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nft_lookup.c