From: Zhiling Zou <zhil…@nebusec.ai> IDLETIMER keeps its timer registry, reference counts, and sysfs files in module-global state, while Xtables invokes checkentry and destroy for rules in individual network namespaces. A matching label from another namespace can therefore reuse and control an existing timer. The sysfs interface is global and cannot represent per-namespace labels with the current target design. Reject IDLETIMER rules outside init_net so that global state stays in the namespace it was built for. Fixes: 0902b469bd25 ("netfilter: xtables: idletimer target implementation") Cc: stab…@vger.kernel.org Reported-by: Vega <ve…@nebusec.ai> Signed-off-by: Zhiling Zou <zhil…@nebusec.ai> Signed-off-by: Pablo Neira Ayuso <pab…@netfilter.org> --- net/netfilter/xt_IDLETIMER.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c index 71b78b5da698..2449c091cdf6 100644 --- a/net/netfilter/xt_IDLETIMER.c +++ b/net/netfilter/xt_IDLETIMER.c @@ -28,6 +28,7 @@ #include <linux/kobject.h> #include <linux/workqueue.h> #include <linux/sysfs.h> +#include <net/net_namespace.h> struct idletimer_tg { struct list_head entry; @@ -308,6 +309,9 @@ static int idletimer_tg_checkentry(const struct xt_tgchk_param *par) struct idletimer_tg_info *info = par->targinfo; int ret; + if (!net_eq(par->net, &init_net)) + return -EOPNOTSUPP; + ret = idletimer_tg_helper(info); if(ret < 0) return -EINVAL; @@ -341,6 +345,9 @@ static int idletimer_tg_checkentry_v1(const struct xt_tgchk_param *par) struct idletimer_tg_info_v1 *info = par->targinfo; int ret; + if (!net_eq(par->net, &init_net)) + return -EOPNOTSUPP; + if (info->send_nl_msg) return -EOPNOTSUPP;
-- 2.47.3