OSDN Git Service

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)
commitdc94902bde1e158cd19c4deab208e5d6eb382a44
tree921d063aaf2197a2bd437f5c9dd0969dc5f68e20
parent717f4b1c52135f279112df82583e0c77e80f90de
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: c538f6ec9f56 ("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