Skip to content

Commit f459bfd

Browse files
committed
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>
1 parent aeac455 commit f459bfd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/netfilter/nft_byteorder.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,24 @@ static int nft_byteorder_dump(struct sk_buff *skb, const struct nft_expr *expr)
167167
return -1;
168168
}
169169

170+
static bool nft_byteorder_reduce(struct nft_regs_track *track,
171+
const struct nft_expr *expr)
172+
{
173+
struct nft_byteorder *priv = nft_expr_priv(expr);
174+
175+
track->regs[priv->dreg].selector = NULL;
176+
track->regs[priv->dreg].bitwise = NULL;
177+
178+
return false;
179+
}
180+
170181
static const struct nft_expr_ops nft_byteorder_ops = {
171182
.type = &nft_byteorder_type,
172183
.size = NFT_EXPR_SIZE(sizeof(struct nft_byteorder)),
173184
.eval = nft_byteorder_eval,
174185
.init = nft_byteorder_init,
175186
.dump = nft_byteorder_dump,
187+
.reduce = nft_byteorder_reduce,
176188
};
177189

178190
struct nft_expr_type nft_byteorder_type __read_mostly = {

0 commit comments

Comments
 (0)