netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check()
authorXin Xiong <xiongx18@fudan.edu.cn>
Thu, 23 Dec 2021 02:48:12 +0000 (10:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:03:50 +0000 (11:03 +0100)
commita1c2d9a513e560864575325b5a316db64ac100fb
tree7a56133db42b20fc21f2ea2aa3f7e44b973274de
parent21bdddc9648b9b44868e496103adfa16d55aaf69
netfilter: ipt_CLUSTERIP: fix refcount leak in clusterip_tg_check()

[ Upstream commit d94a69cb2cfa77294921aae9afcfb866e723a2da ]

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: 06aa151ad1fc74 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/netfilter/ipt_CLUSTERIP.c