dm crypt: mark key as invalid until properly loaded
authorOndrej Kozina <okozina@redhat.com>
Wed, 2 Nov 2016 14:02:08 +0000 (15:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 20 Jun 2017 06:02:38 +0000 (08:02 +0200)
commit3044e1958de35175526af69f0bba20d415229744
treea77b2a1383cac9acf5db9572a7fe8c7b1cee1b07
parent1dd3d3e635c3b9538d693a616b150ddeb3662963
dm crypt: mark key as invalid until properly loaded

commit 265e9098bac02bc5e36cda21fdbad34cb5b2f48d upstream.

In crypt_set_key(), if a failure occurs while replacing the old key
(e.g. tfm->setkey() fails) the key must not have DM_CRYPT_KEY_VALID flag
set.  Otherwise, the crypto layer would have an invalid key that still
has DM_CRYPT_KEY_VALID flag set.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/md/dm-crypt.c