Skip to content

Commit b5c37fe

Browse files
Daniel Borkmanndavem330
authored andcommitted
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: Daniel Borkmann <dborkman@redhat.com> Acked-by: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6ba542a commit b5c37fe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/sctp/endpointola.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
249249
/* Final destructor for endpoint. */
250250
static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
251251
{
252+
int i;
253+
252254
SCTP_ASSERT(ep->base.dead, "Endpoint is not dead", return);
253255

254256
/* Free up the HMAC transform. */
@@ -271,6 +273,9 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
271273
sctp_inq_free(&ep->base.inqueue);
272274
sctp_bind_addr_free(&ep->base.bind_addr);
273275

276+
for (i = 0; i < SCTP_HOW_MANY_SECRETS; ++i)
277+
memset(&ep->secret_key[i], 0, SCTP_SECRET_SIZE);
278+
274279
/* Remove and free the port */
275280
if (sctp_sk(ep->base.sk)->bind_hash)
276281
sctp_put_port(ep->base.sk);

0 commit comments

Comments
 (0)