Received: by 10.223.185.116 with SMTP id b49csp970789wrg; Wed, 21 Feb 2018 09:52:39 -0800 (PST) X-Google-Smtp-Source: AH8x224hQVc80fPXAGaOXP+b/MGj6uPF/yL+z7wNzhUTLCCI0LiBLZoDUwZShRac2nZMK8wQtSxJ X-Received: by 10.98.166.200 with SMTP id r69mr4070153pfl.205.1519235559818; Wed, 21 Feb 2018 09:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519235559; cv=none; d=google.com; s=arc-20160816; b=Biq3OEAA//Wwd3GFGyUUDEnCny72avgf82UsMY5ueyhk2I+hBnO7dVvEMXYLbt5DLv RmjeJEbsESQxzHEaBtARwZQQncbNU+6q1D18+13SGbzrHP5kgP+cR+VkdUSX0O3vx192 0S7ArZTBYWbne0oTyuDi5TKiOQapq86mmZ0aEEHtt7FUfbqYQmoaAV4XlTTYyg6mX3hB Gw9mNg01Wh82gfmtMVJtS/HDZe95J/fdlgKunZ7IDJrUWWP/E7j57O77X2mPLwHIjSA4 7HObDeWuO9cvppT8twYj6SOorUlWuWgM3kdbSLyviBeyq7hgWwtmrEDHG9pu89K4vhgZ gg2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OHv0djUL33R2Vj9DcSrVOLmdt/QgOn1U1tOPZyUp4zw=; b=GdR1XLSnne5IV9HOATNEW6MtQ2vUE0s7gFIxPYBKShAu9mOOI3tYG/pwOW/qfyWgiD zXJNb1F8XHA/RQ7EN06N+T2zCiGQELn4RrrygA7FhB3ueh8DGFPrSKrt/bHztbBem/jJ CboHQ1Kr1kdqJP03qvIEF+p595ZRSizeV2w5h0RnedKyg+yKsmFwD6BSFm8jgtF9FGbf rxShqSFK8DXnRIVCHi2wlHcG3t/2kZGFUfefCiOztjRf94WG+2cG1avMPKvhAMqgUSag m6KY5I7mkeY9+fO9K/RHXmOMTAMMTRceQ4IwtXJ0AEgqmJxNyU+VG/Ck/g0ef3z/ygiL jA8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si205276pfg.279.2018.02.21.09.52.25; Wed, 21 Feb 2018 09:52:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934096AbeBUMyn (ORCPT + 99 others); Wed, 21 Feb 2018 07:54:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34152 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932675AbeBUMyk (ORCPT ); Wed, 21 Feb 2018 07:54:40 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 42331114F; Wed, 21 Feb 2018 12:54:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Elfring , David Disseldorp , Nicholas Bellinger Subject: [PATCH 4.9 17/77] target/iscsi: avoid NULL dereference in CHAP auth error path Date: Wed, 21 Feb 2018 13:48:26 +0100 Message-Id: <20180221124432.904654100@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Disseldorp 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 Signed-off-by: David Disseldorp Cc: stable@vger.kernel.org # 4.6+ Signed-off-by: Nicholas Bellinger Signed-off-by: Greg Kroah-Hartman --- drivers/target/iscsi/iscsi_target_auth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c @@ -413,7 +413,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;