Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11812093pjo; Thu, 2 Jan 2020 14:42:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyWzM/CHB+RcRxxjqx0WRb3YIQFBoLRQEJywOIn5haALzOnOchYBnT7+JsX+G1ijExtRLOb X-Received: by 2002:a9d:6441:: with SMTP id m1mr78965427otl.310.1578004952735; Thu, 02 Jan 2020 14:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578004952; cv=none; d=google.com; s=arc-20160816; b=mOsrvq42gpdcNtv9kqmxOuOvykMDhDt6oWJGQfUiKreOGak7kQG9HGJEBLyc6ZzN4e UA65bR49b5905bfCLjf5N3AjQGczpoHb/5BzldwTIHZ4nlyuggVItMtHbFccEmaFLb3L cxyW4GJsyjF/th9x2flQWklYkzvbXGub3TIQX5J2K7f3Nj56xIhIQIWgQsfMWUDcCPVj 97QWIMBWwAKI0zGBj/PU8RAnPLSJJA1NK7g9tK+Vz7LUXVhD29adOMrqCigMJcNs5sTM Ov0fsCYhRufoZAhj/mUkqtoN/9/vcPzYVl2zR07ha2CZuyuoR88ms0OyotddmG74Oxi4 HvkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UKtYkbYaiD3oAl8tFb7NFmbrUaYptgVab5IOt2QYo+s=; b=a7UxC0EBel8mGOsRPoWq7c6tuexRcC6Q7KoQuoa8I2EbA7DT4OwsIVkmeqWA8DSEpi M5ab2XptGMHVgp63Jyo9Uz5/R7lxFKZospRReDo2ddp6m/gQPOPQKc8y1tnYGHIaJyuS n3MSAGUnDiTRGnyOjTajBLICh2ZkYj6j776DdPp32hzoG1/HOfFVUI841ocdxjlW/7Sl hKFpS68pE3y3mwEmMmaBDso/UMVpeEBt/EeVi/Isn5zpo5/XM3NVT2/cwefsaVGyOPY0 bBkbpYyxIPo2rlL788LHX7MaeQ/uCC3dZtlM11qgJxzfLubX3V/E05Ri8SLYVBEd2KSK 0yGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QkNr4YXu; 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 y8si29263300otg.309.2020.01.02.14.42.21; Thu, 02 Jan 2020 14:42:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=QkNr4YXu; 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 S1731095AbgABWhb (ORCPT + 99 others); Thu, 2 Jan 2020 17:37:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:49916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730934AbgABWh0 (ORCPT ); Thu, 2 Jan 2020 17:37:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 22F7420863; Thu, 2 Jan 2020 22:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004645; bh=C3/V/o5quZsiFkFvPBd0YLWdGQfBoqhIaPTDFQR59vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QkNr4YXuDXpu61ZaDsDAko87UId/A8l+la8Sh8hY3KzRAtVBi0Yht4MMuQMDvLHsz jIvEqIhPxT560yaSjQBMIih4RjeqSCOWPrBO4gYCXof1xSqbv7OCfDa4M+d+NBHJHS M6PopZjsXXCEZLpRGiafJ3+Djp8//9Reqp127ECs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Duncan , Mike Christie , David Disseldorp , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.4 094/137] scsi: target: compare full CHAP_A Algorithm strings Date: Thu, 2 Jan 2020 23:07:47 +0100 Message-Id: <20200102220559.535452599@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Disseldorp [ Upstream commit 9cef2a7955f2754257a7cddedec16edae7b587d0 ] RFC 2307 states: For CHAP [RFC1994], in the first step, the initiator MUST send: CHAP_A= Where A1,A2... are proposed algorithms, in order of preference. ... For the Algorithm, as stated in [RFC1994], one value is required to be implemented: 5 (CHAP with MD5) LIO currently checks for this value by only comparing a single byte in the tokenized Algorithm string, which means that any value starting with a '5' (e.g. "55") is interpreted as "CHAP with MD5". Fix this by comparing the entire tokenized string. Reviewed-by: Lee Duncan Reviewed-by: Mike Christie Signed-off-by: David Disseldorp Link: https://lore.kernel.org/r/20190912095547.22427-2-ddiss@suse.de Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/target/iscsi/iscsi_target_auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index 3184e023a052..1dd6028eccb9 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c @@ -74,7 +74,7 @@ static int chap_check_algorithm(const char *a_str) if (!token) goto out; - if (!strncmp(token, "5", 1)) { + if (!strcmp(token, "5")) { pr_debug("Selected MD5 Algorithm\n"); kfree(orig); return CHAP_DIGEST_MD5; -- 2.20.1