diff options
author | David S. Miller <davem@davemloft.net> | 2013-02-08 14:55:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-08 14:55:08 -0500 |
commit | a1c83b054ebe1264ed9ae9d5c286f9eae68e60ea (patch) | |
tree | 1a4ba4d878e6d2ff60b874a8f465ada2ac54bff7 | |
parent | ab54ee80aa7585f9666ff4dd665441d7ce41f1e8 (diff) | |
parent | b5c37fe6e24eec194bb29d22fdd55d73bcc709bf (diff) | |
download | linux-3.10-a1c83b054ebe1264ed9ae9d5c286f9eae68e60ea.tar.gz linux-3.10-a1c83b054ebe1264ed9ae9d5c286f9eae68e60ea.tar.bz2 linux-3.10-a1c83b054ebe1264ed9ae9d5c286f9eae68e60ea.zip |
Merge branch 'sctp_keys'
Daniel Borkmann says:
====================
Cryptographically used keys should be zeroed out when our session
ends resp. memory is freed, thus do not leave them somewhere in the
memory.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sctp/endpointola.c | 5 | ||||
-rw-r--r-- | net/sctp/socket.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 17a001bac2c..1a9c5fb7731 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c @@ -249,6 +249,8 @@ void sctp_endpoint_free(struct sctp_endpoint *ep) /* Final destructor for endpoint. */ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) { + int i; + SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return); /* Free up the HMAC transform. */ @@ -271,6 +273,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) sctp_inq_free(&ep->base.inqueue); sctp_bind_addr_free(&ep->base.bind_addr); + for (i = 0; i < SCTP_HOW_MANY_SECRETS; ++i) + memset(&ep->secret_key[i], 0, SCTP_SECRET_SIZE); + /* Remove and free the port */ if (sctp_sk(ep->base.sk)->bind_hash) sctp_put_port(ep->base.sk); diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 9e65758cb03..cedd9bf67b8 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3390,7 +3390,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk, ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey); out: - kfree(authkey); + kzfree(authkey); return ret; } |