Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1987814imm; Thu, 24 May 2018 04:05:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp6i6DC4BCh6xn9BglZQ+L4XVbu5mb+8Fj95TT50LadAi5KkpA/Y1t0pxvTy7VzH7bDrxp2 X-Received: by 2002:a17:902:8a8c:: with SMTP id p12-v6mr6749917plo.94.1527159952389; Thu, 24 May 2018 04:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159952; cv=none; d=google.com; s=arc-20160816; b=bE0yE0LgLn/ub9mwjId0CVHYAZbW273ZuH5WoCuDkj09FALWnKeCkJjzA8FYJmiWuM ekIcpPXoLyCev7ObLP6SIF7hFobU5lwPmmcdW1tg83fVCStfVoaJb/HY9q/tngDmz2kA LIJzold5cMJR8r+JcT/68IMMyE0bwP9PAm6J0tjxCkxVToWdULqEYqwbdjIPvbdXGTZA hrp21ArDywaUK0eTcUjj/SFDXY4FY45WtfRrg4LE3ec3904RouUwkukO4NMIunds368l 0baTLiwSA47oJipN4ReeIj6SiRtuaBz7Af96nOm6zQqa480ahmNvTNHQryhHoJ6D0S00 yR8w== 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=e2+P9MOMT6hd9Lc4Xhju6idD4pKsII5q99nU7GGGSNI=; b=uUHUZqh8WGcmBFW1UN2mgvyx1Y1s7oFDvJsVeABGTfDJl4PbO7Ijjue3R7t08tbzfJ uDykUi94aibedAQPN032M/Nkha44AptUeATLuy7Gx0oUjZYF/4TaLaPg/YzAXUCrTRg2 gl3moMs4zf8/+C2/5FOSzHqBHARReiC/SWlnAHIOYNTOMscAsHYaqoSBSCxA8gZB7JQE yMjtRNhfgN7H70v2Sh80+ZODYbVpAGoNkwngAr/MrnWAgSj40+GK5K4hE0RKCtfJUkJM D1fd/gbTPps6yf0UFcd6p9ezozN48B0umWPYrqFOsNsIiHn2oSgo5KQDMpoDjQea/jyO Y8mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T7jthiHd; 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 m26-v6si21555668pfk.56.2018.05.24.04.05.37; Thu, 24 May 2018 04:05:52 -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=T7jthiHd; 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 S968603AbeEXLEq (ORCPT + 99 others); Thu, 24 May 2018 07:04:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:35514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968351AbeEXJzY (ORCPT ); Thu, 24 May 2018 05:55:24 -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 284D6208B8; Thu, 24 May 2018 09:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155723; bh=UyRW095zIK3OeFD8SMC8bhdQF7X54gxZvCfVlvzzQls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7jthiHdO0fcCQiT/NNp2bah+CUZ8YgTbL4+yDIkfaCxTLwX9co5A0R8KblZQqY5I Ut1yMINYi8mToH9Cs1SloCNj3F2lNm4LL0AplnwsXSJIf1Oay0c+XD+Gyq9/S4NrGv qkrpssCnG/Vyig1V0Sg5StriK2QYAu55x7XW/rFY= 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 094/165] crypto: inside-secure - do not process request if no command was issued Date: Thu, 24 May 2018 11:38:20 +0200 Message-Id: <20180524093625.824194216@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 95831ceafc0de7d94a5fe86ebb1c2042317cc2cd ] This patch adds a check in the SafeXcel dequeue function, to avoid processing request further if no hardware command was issued. This can happen in certain cases where the ->send() function caches all the data that would have been send. 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.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -462,6 +462,15 @@ void safexcel_dequeue(struct safexcel_cr if (backlog) backlog->complete(backlog, -EINPROGRESS); + /* In case the send() helper did not issue any command to push + * to the engine because the input data was cached, continue to + * dequeue other requests as this is valid and not an error. + */ + if (!commands && !results) { + kfree(request); + continue; + } + spin_lock_bh(&priv->ring[ring].egress_lock); list_add_tail(&request->list, &priv->ring[ring].list); spin_unlock_bh(&priv->ring[ring].egress_lock);