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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jan 2018 18:58:19 +0000 (19:58 +0100)
commit82e12f1b26bae6b717c33af6395cf476bf3a6461
tree0590d72d53a19bb2caa42f098bf17a207f8fcb79
parent6b8fdeadeb79ff48a5a412c0480d1e74a6da7fba
dm crypt: wipe kernel key copy after IV initialization

commit dc94902bde1e158cd19c4deab208e5d6eb382a44 upstream.

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")
Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Reviewed-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-crypt.c