netfilter: x_tables: set module owner for icmp(6) matches
authorFlorian Westphal <fw@strlen.de>
Wed, 4 Jul 2018 18:25:32 +0000 (20:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Aug 2018 11:09:13 +0000 (13:09 +0200)
[ Upstream commit d376bef9c29b3c65aeee4e785fffcd97ef0a9a81 ]

nft_compat relies on xt_request_find_match to increment
refcount of the module that provides the match/target.

The (builtin) icmp matches did't set the module owner so it
was possible to rmmod ip(6)tables while icmp extensions were still in use.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c

index 114d4bef1bec291ca56173c5370cd20dbf2996ae..0d1a2cda1bfb1b7490615c54c8b1646c6d6e8a53 100644 (file)
@@ -1894,6 +1894,7 @@ static struct xt_match ipt_builtin_mt[] __read_mostly = {
                .checkentry = icmp_checkentry,
                .proto      = IPPROTO_ICMP,
                .family     = NFPROTO_IPV4,
+               .me         = THIS_MODULE,
        },
 };
 
index 2e51e01569030a3cc7d0837470372728b765c412..90f5bf2502a73f1b6b7c2b1403a01eee7814783f 100644 (file)
@@ -1907,6 +1907,7 @@ static struct xt_match ip6t_builtin_mt[] __read_mostly = {
                .checkentry = icmp6_checkentry,
                .proto      = IPPROTO_ICMPV6,
                .family     = NFPROTO_IPV6,
+               .me         = THIS_MODULE,
        },
 };