Browse files

net: sctp: sctp_setsockopt_auth_key: use kzfree instead of kfree

[ Upstream commit 6ba542a291a5e558603ac51cda9bded347ce7627 ]

In sctp_setsockopt_auth_key, we create a temporary copy of the user
passed shared auth key for the endpoint or association and after
internal setup, we free it right away. Since it's sensitive data, we
should zero out the key before returning the memory back to the
allocator. Thus, use kzfree instead of kfree, just as we do in

Signed-off-by: Daniel Borkmann <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
  • Loading branch information...
1 parent 4c921d0 commit 8a501d87edf7190e8fe1741d9312dfcb6361c538 @borkmann borkmann committed with gregkh Feb 8, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 net/sctp/socket.c
@@ -3375,7 +3375,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk,
ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);
- kfree(authkey);
+ kzfree(authkey);
return ret;

0 comments on commit 8a501d8

Please sign in to comment.