Skip to content

Commit d94a69c

Browse files
Conchy-Conchyummakynes
authored andcommitted
netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check()
The issue takes place in one error path of clusterip_tg_check(). When memcmp() returns nonzero, the function simply returns the error code, forgetting to decrease the reference count of a clusterip_config object, which is bumped earlier by clusterip_config_find_get(). This may incur reference count leak. Fix this issue by decrementing the refcount of the object in specific error path. Fixes: 06aa151 ("netfilter: ipt_CLUSTERIP: check MAC address when duplicate config is set") Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn> Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn> Signed-off-by: Xin Tan <tanxin.ctf@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 1d5a474 commit d94a69c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

net/ipv4/netfilter/ipt_CLUSTERIP.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,11 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
520520
if (IS_ERR(config))
521521
return PTR_ERR(config);
522522
}
523-
} else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN))
523+
} else if (memcmp(&config->clustermac, &cipinfo->clustermac, ETH_ALEN)) {
524+
clusterip_config_entry_put(config);
525+
clusterip_config_put(config);
524526
return -EINVAL;
527+
}
525528

526529
ret = nf_ct_netns_get(par->net, par->family);
527530
if (ret < 0) {

0 commit comments

Comments
 (0)