diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-01-26 01:46:58 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-01-27 00:07:24 +0100 |
commit | f459bfd4b9793f25e0fcf19878edd87d8dc569d9 (patch) | |
tree | 721d0fb48b2c0e87ecc6e0fc62a6b2f58a428a82 /net | |
parent | aeac4554eb549037ff2f719200c0a9c1c25e7eaa (diff) | |
download | linux-stable-f459bfd4b9793f25e0fcf19878edd87d8dc569d9.tar.gz linux-stable-f459bfd4b9793f25e0fcf19878edd87d8dc569d9.tar.bz2 linux-stable-f459bfd4b9793f25e0fcf19878edd87d8dc569d9.zip |
netfilter: nft_byteorder: track register operations
Cancel tracking for byteorder operation, otherwise selector + byteorder
operation is incorrectly reduced if source and destination registers are
the same.
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nft_byteorder.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/net/netfilter/nft_byteorder.c b/net/netfilter/nft_byteorder.c index 9d5947ab8d4e..e646e9ee4a98 100644 --- a/net/netfilter/nft_byteorder.c +++ b/net/netfilter/nft_byteorder.c @@ -167,12 +167,24 @@ nla_put_failure: return -1; } +static bool nft_byteorder_reduce(struct nft_regs_track *track, + const struct nft_expr *expr) +{ + struct nft_byteorder *priv = nft_expr_priv(expr); + + track->regs[priv->dreg].selector = NULL; + track->regs[priv->dreg].bitwise = NULL; + + return false; +} + static const struct nft_expr_ops nft_byteorder_ops = { .type = &nft_byteorder_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)), .eval = nft_byteorder_eval, .init = nft_byteorder_init, .dump = nft_byteorder_dump, + .reduce = nft_byteorder_reduce, }; struct nft_expr_type nft_byteorder_type __read_mostly = { |