[Devel] [PATCH rh7] netfilter/vzprivnet: Fix memleaks of 'struct seq_operations'

Andrey Ryabinin aryabinin at virtuozzo.com
Sat Dec 29 17:48:39 MSK 2018


single_open() allocates seq_operations struct, which leaked because
some 'proc_stat_ops', proc_classify_ops, proc_classify6_ops use seq_release
'release' callback instead of single_release. Fix this.

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 net/ipv4/netfilter/ip_vzprivnet.c  | 4 ++--
 net/ipv6/netfilter/ip6_vzprivnet.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/netfilter/ip_vzprivnet.c b/net/ipv4/netfilter/ip_vzprivnet.c
index d12de08fd34b..473e4ed77997 100644
--- a/net/ipv4/netfilter/ip_vzprivnet.c
+++ b/net/ipv4/netfilter/ip_vzprivnet.c
@@ -958,7 +958,7 @@ static struct file_operations proc_stat_ops = {
 	.open    = stat_seq_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
-	.release = seq_release,
+	.release = single_release,
 };
 
 static char sample_ip[16];
@@ -1037,7 +1037,7 @@ static struct file_operations proc_classify_ops = {
 	.open    = classify_seq_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
-	.release = seq_release,
+	.release = single_release,
 	.write	 = classify_write,
 };
 
diff --git a/net/ipv6/netfilter/ip6_vzprivnet.c b/net/ipv6/netfilter/ip6_vzprivnet.c
index 2bd75f123c74..6435cf6e260d 100644
--- a/net/ipv6/netfilter/ip6_vzprivnet.c
+++ b/net/ipv6/netfilter/ip6_vzprivnet.c
@@ -856,7 +856,7 @@ static struct file_operations proc_classify6_ops = {
 	.open    = classify6_seq_open,
 	.read    = seq_read,
 	.llseek  = seq_lseek,
-	.release = seq_release,
+	.release = single_release,
 	.write	 = classify6_write,
 };
 
-- 
2.19.2



More information about the Devel mailing list