Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5c37fe6 authored by Daniel Borkmann's avatar Daniel Borkmann Committed by David S. Miller
Browse files

net: sctp: sctp_endpoint_free: zero out secret key data



On sctp_endpoint_destroy, previously used sensitive keying material
should be zeroed out before the memory is returned, as we already do
with e.g. auth keys when released.

Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
Acked-by: default avatarVlad Yasevich <vyasevic@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ba542a2
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -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)
	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);