Skip to content

Commit f6e1532

Browse files
committed
netfilter: nf_tables: validate family when identifying table via handle
Validate table family when looking up for it via NFTA_TABLE_HANDLE. Fixes: 3ecbfd6 ("netfilter: nf_tables: allocate handle and delete objects via handle") Reported-by: Xingyuan Mo <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 3701cd3 commit f6e1532

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,14 +803,15 @@ static struct nft_table *nft_table_lookup(const struct net *net,
803803

804804
static struct nft_table *nft_table_lookup_byhandle(const struct net *net,
805805
const struct nlattr *nla,
806-
u8 genmask, u32 nlpid)
806+
int family, u8 genmask, u32 nlpid)
807807
{
808808
struct nftables_pernet *nft_net;
809809
struct nft_table *table;
810810

811811
nft_net = nft_pernet(net);
812812
list_for_each_entry(table, &nft_net->tables, list) {
813813
if (be64_to_cpu(nla_get_be64(nla)) == table->handle &&
814+
table->family == family &&
814815
nft_active_genmask(table, genmask)) {
815816
if (nft_table_has_owner(table) &&
816817
nlpid && table->nlpid != nlpid)
@@ -1544,7 +1545,7 @@ static int nf_tables_deltable(struct sk_buff *skb, const struct nfnl_info *info,
15441545

15451546
if (nla[NFTA_TABLE_HANDLE]) {
15461547
attr = nla[NFTA_TABLE_HANDLE];
1547-
table = nft_table_lookup_byhandle(net, attr, genmask,
1548+
table = nft_table_lookup_byhandle(net, attr, family, genmask,
15481549
NETLINK_CB(skb).portid);
15491550
} else {
15501551
attr = nla[NFTA_TABLE_NAME];

0 commit comments

Comments
 (0)