Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a014bc8f authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller
Browse files

[IPVS]: Don't leak sysctl tables if the scheduler registration fails.



In case we load lblc or lblcr module we can leak some sysctl
tables if the call to register_ip_vs_scheduler() fails.

I've looked at the register_ip_vs_scheduler() code and saw, that
the only reason to fail is the name collision, so I think that
with some 3rd party schedulers this becomes a relevant issue. No?

Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e3c0ac04
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -580,9 +580,14 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =

static int __init ip_vs_lblc_init(void)
{
	int ret;

	INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list);
	sysctl_header = register_sysctl_table(lblc_root_table);
	return register_ip_vs_scheduler(&ip_vs_lblc_scheduler);
	ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler);
	if (ret)
		unregister_sysctl_table(sysctl_header);
	return ret;
}


+6 −1
Original line number Diff line number Diff line
@@ -769,9 +769,14 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =

static int __init ip_vs_lblcr_init(void)
{
	int ret;

	INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
	sysctl_header = register_sysctl_table(lblcr_root_table);
	return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
	ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
	if (ret)
		unregister_sysctl_table(sysctl_header);
	return ret;
}