Skip to content

Commit

Permalink
netfilter: nft_byteorder: track register operations
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
ummakynes committed Jan 26, 2022
1 parent aeac455 commit f459bfd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions net/netfilter/nft_byteorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,24 @@ static int nft_byteorder_dump(struct sk_buff *skb, const struct nft_expr *expr)
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 = {
Expand Down

0 comments on commit f459bfd

Please sign in to comment.