Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1918960imm; Thu, 24 May 2018 02:56:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrVYt33yDW4uE/M4CQKDEjlCXNzMyBGGCgGoZnGpWrnmYkFI1Q4J2HhKCTZPPxPv0Q6zWFY X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr6445087plb.30.1527155792044; Thu, 24 May 2018 02:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155792; cv=none; d=google.com; s=arc-20160816; b=ujoQx6dBGn2a74CYyoNeuvHiaY6tWXk7l8rd7lz9TJlwYuhn2bymsI+BygfRCtk9IA Jqu+yPk9P3rx4ewhI4GnCJrnqoAq4jftw1ss2RKvrsNIoSTok1AuT5Li4YWRH/BCQknS NnI2vEfpi/MqCT2+AsyXbhUp60iQ6OHFU2KJd9gp+21KZviygPV6MSwVm+chAwl8vUxY ZGdKw58IDhcq3Nc6Q0DAy1odu+UvHsQ8MZKFs/wE0gfMMJi/w54KUgz+FrEfHZVi1JF/ 0DXsS8MEMHrwo008km+xkkVWvx074qj3L17FwJt0+qj+GjbKDxz7emvRFcvUn2L/kzZA 5h9w== 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:dkim-signature :arc-authentication-results; bh=6+z608V0bcqzxlsRjDI8NdO5aKQ5s25r9XfrS+2h9yQ=; b=V9+ohECB/Y/szOYD3gf2atTYCx8SzJXNeoHj2R43ICRv/nuYsDipcszRfNElvcsKQq SoeyS9YWPFktFfaLQL5ppOCdF7IDVm5FkTyCWxGNDNOiGTUgs6CXB2fQ5exCNYwWz0Es AGul1v9kyWfL4PBvGH2Cs4kJFUSQhEPMT32vCOgsZF+3ub28SDM/Xfq7HP6w9iG9h8EJ 6fsaw1SK4fD/R2duykI7r1imZ6OBsI2w3JGWlvW8/E0OJLErb5FaPxbU3c8J6BgffB/Q Tx7RdfIKs6DVwGtioiDRJOWhVMs54eOAU7lIZRHX2j77zEPTiStBuVJ2DfFGpNTOq9wy 3fpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C3vVrWDc; 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 w20-v6si11328814pgc.645.2018.05.24.02.56.17; Thu, 24 May 2018 02:56:32 -0700 (PDT) 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=C3vVrWDc; 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 S968374AbeEXJza (ORCPT + 99 others); Thu, 24 May 2018 05:55:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:35534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968361AbeEXJz0 (ORCPT ); Thu, 24 May 2018 05:55:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 DB00920892; Thu, 24 May 2018 09:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155726; bh=y2sYowZXVELFKQvxS/cN+zIlh8t1ONBOFTbV8hk15XE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3vVrWDclAfpXKVIVluRkK6QuVgwvCAAeJnjV5fqavDCpPL3NWalNzk26LaQo1o/d 6YzkRiK2NQbxhpn9MGs5ogUIqSeS9ZST/0nCzTpiQ2+QCSwx4MKvLX6UTTlEhLoq5e M8OdJ4r+qbHv2uYiRDjjZyXO1OrvbP2/or2jI0pE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antoine Tenart , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 095/165] crypto: inside-secure - fix the cache_len computation Date: Thu, 24 May 2018 11:38:21 +0200 Message-Id: <20180524093625.864684635@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Antoine Tenart [ Upstream commit 666a9c70b04fccabde5cea5e680ae1ae92460a62 ] This patch fixes the cache length computation as cache_len could end up being a negative value. The check between the queued size and the block size is updated to reflect the caching mechanism which can cache up to a full block size (included!). Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block") Signed-off-by: Antoine Tenart Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/inside-secure/safexcel_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c @@ -185,7 +185,7 @@ static int safexcel_ahash_send_req(struc int i, queued, len, cache_len, extra, n_cdesc = 0, ret = 0; queued = len = req->len - req->processed; - if (queued < crypto_ahash_blocksize(ahash)) + if (queued <= crypto_ahash_blocksize(ahash)) cache_len = queued; else cache_len = queued - areq->nbytes;