@@ -2458,7 +2458,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
2458
2458
2459
2459
static struct nft_chain * nft_chain_lookup_byid (const struct net * net ,
2460
2460
const struct nft_table * table ,
2461
- const struct nlattr * nla )
2461
+ const struct nlattr * nla , u8 genmask )
2462
2462
{
2463
2463
struct nftables_pernet * nft_net = nft_pernet (net );
2464
2464
u32 id = ntohl (nla_get_be32 (nla ));
@@ -2469,7 +2469,8 @@ static struct nft_chain *nft_chain_lookup_byid(const struct net *net,
2469
2469
2470
2470
if (trans -> msg_type == NFT_MSG_NEWCHAIN &&
2471
2471
chain -> table == table &&
2472
- id == nft_trans_chain_id (trans ))
2472
+ id == nft_trans_chain_id (trans ) &&
2473
+ nft_active_genmask (chain , genmask ))
2473
2474
return chain ;
2474
2475
}
2475
2476
return ERR_PTR (- ENOENT );
@@ -3463,7 +3464,8 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
3463
3464
return - EOPNOTSUPP ;
3464
3465
3465
3466
} else if (nla [NFTA_RULE_CHAIN_ID ]) {
3466
- chain = nft_chain_lookup_byid (net , table , nla [NFTA_RULE_CHAIN_ID ]);
3467
+ chain = nft_chain_lookup_byid (net , table , nla [NFTA_RULE_CHAIN_ID ],
3468
+ genmask );
3467
3469
if (IS_ERR (chain )) {
3468
3470
NL_SET_BAD_ATTR (extack , nla [NFTA_RULE_CHAIN_ID ]);
3469
3471
return PTR_ERR (chain );
@@ -9732,7 +9734,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
9732
9734
genmask );
9733
9735
} else if (tb [NFTA_VERDICT_CHAIN_ID ]) {
9734
9736
chain = nft_chain_lookup_byid (ctx -> net , ctx -> table ,
9735
- tb [NFTA_VERDICT_CHAIN_ID ]);
9737
+ tb [NFTA_VERDICT_CHAIN_ID ],
9738
+ genmask );
9736
9739
if (IS_ERR (chain ))
9737
9740
return PTR_ERR (chain );
9738
9741
} else {
0 commit comments