dm crypt: fix crash by adding missing check for auth key size
authorMilan Broz <gmazyland@gmail.com>
Wed, 3 Jan 2018 21:48:59 +0000 (22:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jan 2018 18:58:19 +0000 (19:58 +0100)
commit6b8fdeadeb79ff48a5a412c0480d1e74a6da7fba
treedb7c0500b6f85a29b3e00df2bface8d18bf32a62
parentc808f1db59561a65c27cb4ffb8515b95e33af221
dm crypt: fix crash by adding missing check for auth key size

commit 27c7003697fc2c78f965984aa224ef26cd6b2949 upstream.

If dm-crypt uses authenticated mode with separate MAC, there are two
concatenated part of the key structure - key(s) for encryption and
authentication key.

Add a missing check for authenticated key length.  If this key length is
smaller than actually provided key, dm-crypt now properly fails instead
of crashing.

Fixes: ef43aa3806 ("dm crypt: add cryptographic data integrity protection (authenticated encryption)")
Reported-by: Salah Coronya <salahx@yahoo.com>
Signed-off-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