Re: [PATCH net] ipvs: fix possible memory leak in ip_vs_control_net_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




在 2020/11/20 2:22, Julian Anastasov 写道:
	Hello,

On Thu, 19 Nov 2020, Wang Hai wrote:

kmemleak report a memory leak as follows:

BUG: memory leak
unreferenced object 0xffff8880759ea000 (size 256):
comm "syz-executor.3", pid 6484, jiffies 4297476946 (age 48.546s)
hex dump (first 32 bytes):
00 00 00 00 01 00 00 00 08 a0 9e 75 80 88 ff ff ...........u....
[...]
Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Wang Hai <wanghai38@xxxxxxxxxx>
---
  net/netfilter/ipvs/ip_vs_ctl.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index e279ded4e306..d99bb89e7c25 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -4180,6 +4180,9 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
  	return 0;
	May be we should add some #ifdef CONFIG_PROC_FS because
proc_create_net* return NULL when PROC is not used. For example:

#ifdef CONFIG_PROC_FS
	if (!proc_create_net...
		goto err_vs;
	if (!proc_create_net...
		goto err_stats;
	...
#endif
	...

  err:
#ifdef CONFIG_PROC_FS
+	remove_proc_entry("ip_vs_stats_percpu", ipvs->net->proc_net);
err_percpu:
+	remove_proc_entry("ip_vs_stats", ipvs->net->proc_net);
err_stats:
+	remove_proc_entry("ip_vs", ipvs->net->proc_net);
err_vs:
#endif

  	free_percpu(ipvs->tot_stats.cpustats);
  	return -ENOMEM;
  }
--
Regards

--
Julian Anastasov <ja@xxxxxx>

.

Thanks for your advice, I just sent v2

“[PATCH net v2] ipvs: fix possible memory leak in ip_vs_control_net_init”





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux