netfilter: fix wrong arithmetics regarding NFT_REJECT_ICMPX_MAX
NFT_REJECT_ICMPX_MAX should be __NFT_REJECT_ICMPX_MAX - 1.
nft_reject_icmp_code() and nft_reject_icmpv6_code() are called from the
packet path, so BUG_ON in case we try to access an unknown abstracted
ICMP code. This should not happen since we already validate this from
nft_reject_{inet,bridge}_init().
Fixes: 51b0a5d ("netfilter: nft_reject: introduce icmp code abstraction for inet and bridge")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
@@ -774,7 +774,7 @@ enum nft_reject_inet_code {
|
||||
NFT_REJECT_ICMPX_ADMIN_PROHIBITED,
|
||||
__NFT_REJECT_ICMPX_MAX
|
||||
};
|
||||
#define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX + 1)
|
||||
#define NFT_REJECT_ICMPX_MAX (__NFT_REJECT_ICMPX_MAX - 1)
|
||||
|
||||
/**
|
||||
* enum nft_reject_attributes - nf_tables reject expression netlink attributes
|
||||
|
||||
Reference in New Issue
Block a user