target/iscsi: avoid NULL dereference in CHAP auth error path
authorDavid Disseldorp <ddiss@suse.de>
Wed, 13 Dec 2017 17:22:30 +0000 (18:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:42:29 +0000 (15:42 +0100)
commit4cbb9fdf133cc5a5dcb1ac7153791792976c62c9
tree4fd974ffef7bcf2a6ce269939ad7896053df6dae
parent0528a533f368c93efe752dbd52698dcea214554a
target/iscsi: avoid NULL dereference in CHAP auth error path

commit ce512d79d0466a604793addb6b769d12ee326822 upstream.

If chap_server_compute_md5() fails early, e.g. via CHAP_N mismatch, then
crypto_free_shash() is called with a NULL pointer which gets
dereferenced in crypto_shash_tfm().

Fixes: 69110e3cedbb ("iscsi-target: Use shash and ahash")
Suggested-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Cc: stable@vger.kernel.org # 4.6+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/target/iscsi/iscsi_target_auth.c