• R/O
  • HTTP
  • SSH
  • HTTPS

linux-2.4.36: Commit

2.4.36-stable kernel tree


Commit MetaInfo

Revision457b8910e4deb9f83b821ae25ae03a0d593df625 (tree)
Zeit2008-09-06 20:35:25
AutorVlad Yasevich <vladislav.yasevich@hp.c...>
CommiterWilly Tarreau

Log Message

sctp: Do not leak memory on multiple listen() calls

[backport of 2.6 commit 23b29ed80bd7184398317a111dc488605cb66c7f]

SCTP permits multiple listen call and on subsequent calls
we leak he memory allocated for the crypto transforms.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>

Ändern Zusammenfassung

Diff

--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3985,7 +3985,7 @@ int sctp_inet_listen(struct socket *sock, int backlog)
39853985 goto out;
39863986
39873987 /* Allocate HMAC for generating cookie. */
3988- if (sctp_hmac_alg) {
3988+ if (!sctp_sk(sk)->hmac && sctp_hmac_alg) {
39893989 tfm = sctp_crypto_alloc_tfm(sctp_hmac_alg, 0);
39903990 if (!tfm) {
39913991 err = -ENOSYS;
@@ -4007,7 +4007,8 @@ int sctp_inet_listen(struct socket *sock, int backlog)
40074007 goto cleanup;
40084008
40094009 /* Store away the transform reference. */
4010- sctp_sk(sk)->hmac = tfm;
4010+ if (!sctp_sk(sk)->hmac)
4011+ sctp_sk(sk)->hmac = tfm;
40114012 out:
40124013 sctp_release_sock(sk);
40134014 return err;
Show on old repository browser