]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.14.28/dm-crypt-use-memzero_explicit-for-on-stack-buffer.patch
Linux 4.14.117
[thirdparty/kernel/stable-queue.git] / releases / 3.14.28 / dm-crypt-use-memzero_explicit-for-on-stack-buffer.patch
1 From 1a71d6ffe18c0d0f03fc8531949cc8ed41d702ee Mon Sep 17 00:00:00 2001
2 From: Milan Broz <gmazyland@gmail.com>
3 Date: Sat, 22 Nov 2014 09:36:04 +0100
4 Subject: dm crypt: use memzero_explicit for on-stack buffer
5
6 From: Milan Broz <gmazyland@gmail.com>
7
8 commit 1a71d6ffe18c0d0f03fc8531949cc8ed41d702ee upstream.
9
10 Use memzero_explicit to cleanup sensitive data allocated on stack
11 to prevent the compiler from optimizing and removing memset() calls.
12
13 Signed-off-by: Milan Broz <gmazyland@gmail.com>
14 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17 ---
18 drivers/md/dm-crypt.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21 --- a/drivers/md/dm-crypt.c
22 +++ b/drivers/md/dm-crypt.c
23 @@ -709,7 +709,7 @@ static int crypt_iv_tcw_whitening(struct
24 for (i = 0; i < ((1 << SECTOR_SHIFT) / 8); i++)
25 crypto_xor(data + i * 8, buf, 8);
26 out:
27 - memset(buf, 0, sizeof(buf));
28 + memzero_explicit(buf, sizeof(buf));
29 return r;
30 }
31