[RHEL7,COMMIT] netfilter/vzprivnet: Fix memleaks of 'struct seq_operations'

Submitted by Konstantin Khorenko on Jan. 10, 2019, 12:59 p.m.

Details

Message ID 201901101259.x0ACx1jJ004361@finist-ce7.sw.ru
State New
Series "netfilter/vzprivnet: Fix memleaks of 'struct seq_operations'"
Headers show

Commit Message

Konstantin Khorenko Jan. 10, 2019, 12:59 p.m.
The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.4
------>
commit 815c8c853aa1b5a8177a75cafe97e383be65a756
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Jan 10 15:59:00 2019 +0300

    netfilter/vzprivnet: Fix memleaks of 'struct seq_operations'
    
    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,
 };