mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-04 18:27:36 +00:00
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: 96518518cc ("netfilter: add nftables")
Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
@@ -619,6 +619,11 @@ static inline void *nft_set_priv(const struct nft_set *set)
|
||||
return (void *)set->data;
|
||||
}
|
||||
|
||||
static inline enum nft_data_types nft_set_datatype(const struct nft_set *set)
|
||||
{
|
||||
return set->dtype == NFT_DATA_VERDICT ? NFT_DATA_VERDICT : NFT_DATA_VALUE;
|
||||
}
|
||||
|
||||
static inline bool nft_set_gc_is_pending(const struct nft_set *s)
|
||||
{
|
||||
return refcount_read(&s->refs) != 1;
|
||||
|
||||
Reference in New Issue
Block a user