mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
netfilter: nf_tables: reject element expiration with no timeout
[ Upstream commit d2dc429ecb4e79ad164028d965c00f689e6f6d06 ]
If element timeout is unset and set provides no default timeout, the
element expiration is silently ignored, reject this instead to let user
know this is unsupported.
Also prepare for supporting timeout that never expire, where zero
timeout and expiration must be also rejected.
Fixes: 8e1102d5a1 ("netfilter: nf_tables: support timeouts larger than 23 days")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6f25895de9
commit
d7b8d3d4a7
@@ -6411,6 +6411,9 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
|
|||||||
if (nla[NFTA_SET_ELEM_EXPIRATION] != NULL) {
|
if (nla[NFTA_SET_ELEM_EXPIRATION] != NULL) {
|
||||||
if (!(set->flags & NFT_SET_TIMEOUT))
|
if (!(set->flags & NFT_SET_TIMEOUT))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
if (timeout == 0)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
err = nf_msecs_to_jiffies64(nla[NFTA_SET_ELEM_EXPIRATION],
|
err = nf_msecs_to_jiffies64(nla[NFTA_SET_ELEM_EXPIRATION],
|
||||||
&expiration);
|
&expiration);
|
||||||
if (err)
|
if (err)
|
||||||
|
|||||||
Reference in New Issue
Block a user