@@ -2699,7 +2699,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
2699
2699
2700
2700
static struct nft_chain * nft_chain_lookup_byid (const struct net * net ,
2701
2701
const struct nft_table * table ,
2702
- const struct nlattr * nla )
2702
+ const struct nlattr * nla , u8 genmask )
2703
2703
{
2704
2704
struct nftables_pernet * nft_net = nft_pernet (net );
2705
2705
u32 id = ntohl (nla_get_be32 (nla ));
@@ -2710,7 +2710,8 @@ static struct nft_chain *nft_chain_lookup_byid(const struct net *net,
2710
2710
2711
2711
if (trans -> msg_type == NFT_MSG_NEWCHAIN &&
2712
2712
chain -> table == table &&
2713
- id == nft_trans_chain_id (trans ))
2713
+ id == nft_trans_chain_id (trans ) &&
2714
+ nft_active_genmask (chain , genmask ))
2714
2715
return chain ;
2715
2716
}
2716
2717
return ERR_PTR (- ENOENT );
@@ -3814,7 +3815,8 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info,
3814
3815
return - EOPNOTSUPP ;
3815
3816
3816
3817
} else if (nla [NFTA_RULE_CHAIN_ID ]) {
3817
- chain = nft_chain_lookup_byid (net , table , nla [NFTA_RULE_CHAIN_ID ]);
3818
+ chain = nft_chain_lookup_byid (net , table , nla [NFTA_RULE_CHAIN_ID ],
3819
+ genmask );
3818
3820
if (IS_ERR (chain )) {
3819
3821
NL_SET_BAD_ATTR (extack , nla [NFTA_RULE_CHAIN_ID ]);
3820
3822
return PTR_ERR (chain );
@@ -10540,7 +10542,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
10540
10542
genmask );
10541
10543
} else if (tb [NFTA_VERDICT_CHAIN_ID ]) {
10542
10544
chain = nft_chain_lookup_byid (ctx -> net , ctx -> table ,
10543
- tb [NFTA_VERDICT_CHAIN_ID ]);
10545
+ tb [NFTA_VERDICT_CHAIN_ID ],
10546
+ genmask );
10544
10547
if (IS_ERR (chain ))
10545
10548
return PTR_ERR (chain );
10546
10549
} else {
0 commit comments