Commit a1c83b05 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents ab54ee80 b5c37fe6
...@@ -249,6 +249,8 @@ void sctp_endpoint_free(struct sctp_endpoint *ep) ...@@ -249,6 +249,8 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
/* Final destructor for endpoint. */ /* Final destructor for endpoint. */
static void sctp_endpoint_destroy(struct sctp_endpoint *ep) static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
{ {
int i;
SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return); SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);
/* Free up the HMAC transform. */ /* Free up the HMAC transform. */
...@@ -271,6 +273,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) ...@@ -271,6 +273,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
sctp_inq_free(&ep->base.inqueue); sctp_inq_free(&ep->base.inqueue);
sctp_bind_addr_free(&ep->base.bind_addr); 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 */ /* Remove and free the port */
if (sctp_sk(ep->base.sk)->bind_hash) if (sctp_sk(ep->base.sk)->bind_hash)
sctp_put_port(ep->base.sk); sctp_put_port(ep->base.sk);
......
...@@ -3390,7 +3390,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk, ...@@ -3390,7 +3390,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey); ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);
out: out:
kfree(authkey); kzfree(authkey);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment