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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jan 10 15:59:03 MSK 2019


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



More information about the Devel mailing list