diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2011-05-24 17:48:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-25 17:55:32 -0400 |
commit | 8b4472cc13136d04727e399c6fdadf58d2218b0a (patch) | |
tree | cad3cdcca69d8a701558386fef36f2f158a570a5 /net | |
parent | f11970e383acd6f505f492f1bc07fb1a4d884829 (diff) |
sctp: fix memory leak of the ASCONF queue when free asoc
If an ASCONF chunk is outstanding, then the following ASCONF
chunk will be queued for later transmission. But when we free
the asoc, we forget to free the ASCONF queue at the same time,
this will cause memory leak.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/associola.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 1a21c571aa0..525f97c467e 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -64,6 +64,7 @@ | |||
64 | /* Forward declarations for internal functions. */ | 64 | /* Forward declarations for internal functions. */ |
65 | static void sctp_assoc_bh_rcv(struct work_struct *work); | 65 | static void sctp_assoc_bh_rcv(struct work_struct *work); |
66 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); | 66 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc); |
67 | static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc); | ||
67 | 68 | ||
68 | /* Keep track of the new idr low so that we don't re-use association id | 69 | /* Keep track of the new idr low so that we don't re-use association id |
69 | * numbers too fast. It is protected by they idr spin lock is in the | 70 | * numbers too fast. It is protected by they idr spin lock is in the |
@@ -446,6 +447,9 @@ void sctp_association_free(struct sctp_association *asoc) | |||
446 | /* Free any cached ASCONF_ACK chunk. */ | 447 | /* Free any cached ASCONF_ACK chunk. */ |
447 | sctp_assoc_free_asconf_acks(asoc); | 448 | sctp_assoc_free_asconf_acks(asoc); |
448 | 449 | ||
450 | /* Free the ASCONF queue. */ | ||
451 | sctp_assoc_free_asconf_queue(asoc); | ||
452 | |||
449 | /* Free any cached ASCONF chunk. */ | 453 | /* Free any cached ASCONF chunk. */ |
450 | if (asoc->addip_last_asconf) | 454 | if (asoc->addip_last_asconf) |
451 | sctp_chunk_free(asoc->addip_last_asconf); | 455 | sctp_chunk_free(asoc->addip_last_asconf); |
@@ -1578,6 +1582,18 @@ retry: | |||
1578 | return error; | 1582 | return error; |
1579 | } | 1583 | } |
1580 | 1584 | ||
1585 | /* Free the ASCONF queue */ | ||
1586 | static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc) | ||
1587 | { | ||
1588 | struct sctp_chunk *asconf; | ||
1589 | struct sctp_chunk *tmp; | ||
1590 | |||
1591 | list_for_each_entry_safe(asconf, tmp, &asoc->addip_chunk_list, list) { | ||
1592 | list_del_init(&asconf->list); | ||
1593 | sctp_chunk_free(asconf); | ||
1594 | } | ||
1595 | } | ||
1596 | |||
1581 | /* Free asconf_ack cache */ | 1597 | /* Free asconf_ack cache */ |
1582 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc) | 1598 | static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc) |
1583 | { | 1599 | { |