@@ -2489,7 +2489,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
2489
2489
2490
2490
static struct nft_chain * nft_chain_lookup_byid (const struct net * net ,
2491
2491
const struct nft_table * table ,
2492
- const struct nlattr * nla )
2492
+ const struct nlattr * nla , u8 genmask )
2493
2493
{
2494
2494
struct nftables_pernet * nft_net = nft_pernet (net );
2495
2495
u32 id = ntohl (nla_get_be32 (nla ));
@@ -2500,7 +2500,8 @@ static struct nft_chain *nft_chain_lookup_byid(const struct net *net,
2500
2500
2501
2501
if (trans -> msg_type == NFT_MSG_NEWCHAIN &&
2502
2502
chain -> table == table &&
2503
- id == nft_trans_chain_id (trans ))
2503
+ id == nft_trans_chain_id (trans ) &&
2504
+ nft_active_genmask (chain , genmask ))
2504
2505
return chain ;
2505
2506
}
2506
2507
return ERR_PTR (- ENOENT );
@@ -3545,7 +3546,8 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
3545
3546
return - EOPNOTSUPP ;
3546
3547
3547
3548
} else if (nla [NFTA_RULE_CHAIN_ID ]) {
3548
- chain = nft_chain_lookup_byid (net , table , nla [NFTA_RULE_CHAIN_ID ]);
3549
+ chain = nft_chain_lookup_byid (net , table , nla [NFTA_RULE_CHAIN_ID ],
3550
+ genmask );
3549
3551
if (IS_ERR (chain )) {
3550
3552
NL_SET_BAD_ATTR (extack , nla [NFTA_RULE_CHAIN_ID ]);
3551
3553
return PTR_ERR (chain );
@@ -9917,7 +9919,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
9917
9919
genmask );
9918
9920
} else if (tb [NFTA_VERDICT_CHAIN_ID ]) {
9919
9921
chain = nft_chain_lookup_byid (ctx -> net , ctx -> table ,
9920
- tb [NFTA_VERDICT_CHAIN_ID ]);
9922
+ tb [NFTA_VERDICT_CHAIN_ID ],
9923
+ genmask );
9921
9924
if (IS_ERR (chain ))
9922
9925
return PTR_ERR (chain );
9923
9926
} else {
0 commit comments