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

Submitted by Andrey Ryabinin on Dec. 29, 2018, 2:48 p.m.

Details

Message ID 20181229144839.29432-1-aryabinin@virtuozzo.com
State New
Series "netfilter/vzprivnet: Fix memleaks of 'struct seq_operations'"
Headers show

Commit Message

Andrey Ryabinin Dec. 29, 2018, 2:48 p.m.
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@virtuozzo.com>
---
 net/ipv4/netfilter/ip_vzprivnet.c  | 4 ++--
 net/ipv6/netfilter/ip6_vzprivnet.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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,
 };