Skip to content

Commit

Permalink
sctp: fix /proc/net/sctp/ memory leak
Browse files Browse the repository at this point in the history
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).

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
rantala authored and davem330 committed Nov 15, 2012
1 parent 80d1178 commit 0da9a0c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/sctp/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0da9a0c

Please sign in to comment.