diff options
author | David Disseldorp <ddiss@suse.de> | 2017-12-13 18:22:30 +0100 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2018-01-12 15:07:27 -0800 |
commit | ce512d79d0466a604793addb6b769d12ee326822 (patch) | |
tree | a6863b9b2a3eacd3635d197762f0727846bb2ae0 /drivers/target/iscsi | |
parent | 093ec1430f41063d65dfc68d7eddec9d80f8efbb (diff) | |
download | op-kernel-dev-ce512d79d0466a604793addb6b769d12ee326822.zip op-kernel-dev-ce512d79d0466a604793addb6b769d12ee326822.tar.gz |
target/iscsi: avoid NULL dereference in CHAP auth error path
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>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index f9bc8ec..9518ffd 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c @@ -421,7 +421,8 @@ static int chap_server_compute_md5( auth_ret = 0; out: kzfree(desc); - crypto_free_shash(tfm); + if (tfm) + crypto_free_shash(tfm); kfree(challenge); kfree(challenge_binhex); return auth_ret; |