Skip to content

Commit 26543e3

Browse files
Conchy-Conchygregkh
authored andcommitted
netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check()
[ Upstream commit d94a69c ] 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 <[email protected]> Signed-off-by: Xiyu Yang <[email protected]> Signed-off-by: Xin Tan <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent c7e84bf commit 26543e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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)