From: Tudor Ambarus Date: Thu, 28 Sep 2017 14:14:54 +0000 (+0300) Subject: Bluetooth: ecdh_helper - fix leak of private key X-Git-Tag: v4.15-rc1~84^2~378^2~22 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=168ed65483a1777c2570f4c0a4a64e20a823cf25;p=linux.git Bluetooth: ecdh_helper - fix leak of private key tmp buffer contains the swapped private key. In case the setkey call failed, the tmp buffer was freed without clearing the private key. Zeroize the temporary buffer so we don't leak the private key. Signed-off-by: Tudor Ambarus Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/ecdh_helper.c b/net/bluetooth/ecdh_helper.c index 22c8daa0b451..16e022f5ab27 100644 --- a/net/bluetooth/ecdh_helper.c +++ b/net/bluetooth/ecdh_helper.c @@ -122,7 +122,7 @@ int compute_ecdh_secret(struct crypto_kpp *tfm, const u8 public_key[64], free_req: kpp_request_free(req); free_tmp: - kfree(tmp); + kzfree(tmp); return err; }