sctp: fix /proc/net/sctp/ memory leak
Subsystems (3)
PATCH v2 1/1 sctp: fix /proc/net/sctp/ memory leak
Commit 13d782f ("sctp: Make the proc files per network namespace.") changed the /proc/net/sctp/ struct file_operations opener functions to use single_open_net() and seq_open_net().
Avoid leaking memory by using single_release_net() and seq_release_net() as the release functions.
Discovered with Trinity (the syscall fuzzer).
--- net/sctp/proc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/sctp/proc.c +4 -4
@@ -102,7 +102,7 @@ static const struct file_operations sctp_snmp_seq_fops = { .open = sctp_snmp_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = single_release, + .release = single_release_net, };/* Set up the proc fs entry for 'snmp' object. */
@@ -251,7 +251,7 @@ static const struct file_operations sctp_eps_seq_fops = { .open = sctp_eps_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, + .release = seq_release_net, };/* Set up the proc fs entry for 'eps' object. */
@@ -372,7 +372,7 @@ static const struct file_operations sctp_assocs_seq_fops = { .open = sctp_assocs_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, + .release = seq_release_net, };/* Set up the proc fs entry for 'assocs' object. */
@@ -517,7 +517,7 @@ static const struct file_operations sctp_remaddr_seq_fops = { .open = sctp_remaddr_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, + .release = seq_release_net, };int __net_init sctp_remaddr_proc_init (struct net *net)
Signature · 1 line
1.7.9.5
From: Tommi Rantala <[email protected]>
Date: Thu, 15 Nov 2012 15:49:05 +0200
Quoted 11 lines
Commit 13d782f ("sctp: Make the proc files per network namespace.") changed the
/proc/net/sctp/structfile_operationsopener functions to usesingle_open_net()andseq_open_net().Avoid leaking memory by using
single_release_net()andseq_release_net()as the release functions.Discovered with Trinity (the syscall fuzzer).
Signed-off-by Tommi Rantala <[email protected]>Acked-by Neil Horman <[email protected]>
Applied.
Quoted 8 lines · Tommi Rantala
Commit 13d782f ("sctp: Make the proc files per network namespace.") changed the
/proc/net/sctp/structfile_operationsopener functions to usesingle_open_net()andseq_open_net().Avoid leaking memory by using
single_release_net()andseq_release_net()as the release functions.Discovered with Trinity (the syscall fuzzer).
Doh! Thanks for catching this.
Eric
Quoted 8 lines
net/sctp/proc.c +2
-2- .release = single_release, + .release = single_release_net, }; - .release = seq_release, + .release = seq_release_net, };