mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data registers
[ Upstream commit 7931d32955e09d0a11b1fe0b6aac1bfa061c005c ]
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 <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
7122df1a13
commit
23752737c6
3 changed files with 11 additions and 5 deletions
|
|
@ -467,6 +467,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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue