]> git.baikalelectronics.ru Git - kernel.git/commit
dm crypt: wipe kernel key copy after IV initialization
authorOndrej Kozina <okozina@redhat.com>
Fri, 12 Jan 2018 15:30:32 +0000 (16:30 +0100)
committerMike Snitzer <snitzer@redhat.com>
Wed, 17 Jan 2018 14:10:48 +0000 (09:10 -0500)
commit365500ddc127a4e7e9423b550af1d16008cd7af3
tree921d063aaf2197a2bd437f5c9dd0969dc5f68e20
parent65db3011aa1c53088379a90b04cb33ea4dd74fa1
dm crypt: wipe kernel key copy after IV initialization

Loading key via kernel keyring service erases the internal
key copy immediately after we pass it in crypto layer. This is
wrong because IV is initialized later and we use wrong key
for the initialization (instead of real key there's just zeroed
block).

The bug may cause data corruption if key is loaded via kernel keyring
service first and later same crypt device is reactivated using exactly
same key in hexbyte representation, or vice versa. The bug (and fix)
affects only ciphers using following IVs: essiv, lmk and tcw.

Fixes: 445de0233653 ("dm crypt: add ability to use keys from the kernel key retention service")
Cc: stable@vger.kernel.org # 4.10+
Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Reviewed-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-crypt.c