Skip to content
/ linux Public

Commit cb54992

Browse files
ummakynesgregkh
authored andcommitted
netfilter: xt_CT: drop pending enqueued packets on template removal
[ Upstream commit f62a218 ] Templates refer to objects that can go away while packets are sitting in nfqueue refer to: - helper, this can be an issue on module removal. - timeout policy, nfnetlink_cttimeout might remove it. The use of templates with zone and event cache filter are safe, since this just copies values. Flush these enqueued packets in case the template rule gets removed. Fixes: 24de58f ("netfilter: xt_CT: allow to attach timeout policy + glue code") Reported-by: Yiming Qian <yimingqian591@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f29a055 commit cb54992

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/netfilter/xt_CT.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <net/netfilter/nf_conntrack_ecache.h>
1717
#include <net/netfilter/nf_conntrack_timeout.h>
1818
#include <net/netfilter/nf_conntrack_zones.h>
19+
#include "nf_internals.h"
1920

2021
static inline int xt_ct_target(struct sk_buff *skb, struct nf_conn *ct)
2122
{
@@ -283,6 +284,9 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par,
283284
struct nf_conn_help *help;
284285

285286
if (ct) {
287+
if (info->helper[0] || info->timeout[0])
288+
nf_queue_nf_hook_drop(par->net);
289+
286290
help = nfct_help(ct);
287291
xt_ct_put_helper(help);
288292

0 commit comments

Comments
 (0)