Received: by 10.223.185.116 with SMTP id b49csp1018523wrg; Wed, 21 Feb 2018 10:39:21 -0800 (PST) X-Google-Smtp-Source: AH8x226Yx/i5dDH6Nb4OqLHt1BTRtEeG7gG/xj13CY0cQW75Q7bnCPkJCovQSv9aTqZXXPS7lc+Q X-Received: by 10.101.88.15 with SMTP id g15mr3385208pgr.383.1519238361764; Wed, 21 Feb 2018 10:39:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238361; cv=none; d=google.com; s=arc-20160816; b=fnXQVz9SWg2NvKEjjr0f6eX82tv3rVy4SQm2zo5ES1KNpMm/rYOunKAGUbwV2MLTnC FQbNHQ3LxBaptAR5uEgH5Ff5lzAxers8S3MhUX8XCkipDcgdbdwuCrjZdwXvycKBpEPd SEhXK9DXhdfmyjwb1JbB48/Bg2023LFa6mYJ8f0RQev+fWkqd46rlxfltSnEatu/IR8u Pf51jDg+h9aj9DoArBV9WeU/UfM+I7V4gqALxuJkxhy7PAc46wvVwOWL45hQR4dM02Bi w7LPkUs/9zy2f7ZUFS5+R2wc/zq7dVTeypgQJ02JJfS6j3/knKaBphTwCpk9NObFMt0i kw1Q== 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=agjgDCXpMnRsakLvdgQNCu4eyO5diyDb6fNkfKvKbdg=; b=gZb9egMAXkmuuahYVpGGherfICZBhy5BWV/p4POGU4seH/jluakuRSVjO+HbjnDsrl CMpO4XALSDVqBOBwVwyJeeH11SKWIlIfmfnDpRCEdwbWGg08+c0p16tLi9jBXfubiOlJ lNF7Hiim7gOHDm13cZqUwA8FWmfzFJMe/Qn88JtYYrVD+Bdse9HTsW3wwndxEi41ctrx psxDp+HIST+R4eLFj4l0NAUKg6xTjwfCDu2CmIKBA+/5347sbyuGu0d6TZIEapcOc4ux 7T+eDE2KvZ6XidVDkz3nQSDZJQ8gPOGEF3Y5v6QdffXE3c6+IIvv99hqYyp54BIz5pMY RpMg== 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 h10-v6si1965205plk.706.2018.02.21.10.39.07; Wed, 21 Feb 2018 10:39:21 -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 S965687AbeBUNM7 (ORCPT + 99 others); Wed, 21 Feb 2018 08:12:59 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45884 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965623AbeBUNM4 (ORCPT ); Wed, 21 Feb 2018 08:12:56 -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 81B6410A2; Wed, 21 Feb 2018 13:12:55 +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.15 132/163] target/iscsi: avoid NULL dereference in CHAP auth error path Date: Wed, 21 Feb 2018 13:49:21 +0100 Message-Id: <20180221124537.467213921@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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 @@ -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;