Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1929352imm; Thu, 24 May 2018 03:06:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqKnEHlH8vVlgcvpIRIz+GrrNq9RawxUT5jE116i2KVB/QtlBEqLfDfUU1QFIIm6J0QYevE X-Received: by 2002:a62:11dc:: with SMTP id 89-v6mr6623733pfr.18.1527156372350; Thu, 24 May 2018 03:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156372; cv=none; d=google.com; s=arc-20160816; b=zI9XboqZAqJMDZMfaBwO6sBbi+VSdMsHNmTkQbGCxglQ4t8VBgci5E5XQSyGiiFiCG t7BSH81gO9PCZm4CBHSWyqBhyI5wFffBIpZ/g4/Jz0hpEIl1rnygnSHQ/1ObHSIMUc4Y YJj+ViGGlleHOYRmyfdB/s5whZQYc7GEdGfIMFKyosg6dK/ZU9OapOciEI0+9Zg+pkej ohIQy5x2LZ8+XJv5F9AJJgDGS8atyQ9NkwXuTqW08UPtTfsnfOQXaVV/QNQatbakgwkK 93acHfm+c87tFOovTyJJYlIhfmB6oMcFIfKzfcAz+LyZ5TP1q/vseprKTktbjESr8s2J OcuA== 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=MK9XvHJTmGrGdOk6tqeKcpWS5u+pZgG/G9R84c7sk8s=; b=Q8+mWfILdpNq53xAKk8ollM++WOMeDUOppmu67NtB4FEXq/U8mr4s0k6iwDyuPY4SF +b6dIQgMQsdrH/ISlLavuAS6QnzXEp22XdmJ4nt8d45yRxRQJLhcffCl8hd/nWGDt2q0 RHzzlsuIs49mn+kfy71lLQLTpTmafkdK+MV9xw+cl1us82EyKb8UWKcgvNb8OmTnvUG/ QnIF8rcEeUvWVlruDQuYVhyM+EI5RTBq7ssrVSBv76pfMTkNU3/mqhiTSTWl69LdI+dc HOXlK6VO4SP6iA6MBVpTsgnhvm4GXXmVJxYdALb6ssPegVRIhq+I8C2qt8DxZB1ABZgj nunA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=odTsD/CI; 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 1-v6si20455026plk.521.2018.05.24.03.05.54; Thu, 24 May 2018 03:06:12 -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=odTsD/CI; 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 S1031510AbeEXKFE (ORCPT + 99 others); Thu, 24 May 2018 06:05:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:54244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031563AbeEXKFA (ORCPT ); Thu, 24 May 2018 06:05:00 -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 3A63620896; Thu, 24 May 2018 10:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156299; bh=WKC1yjHfC2Frj4Gu3mSURYWnPy/JnTRRq5LhvCSAFkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=odTsD/CIj+/HiOk+Z6YgGsaMm1pn0ZK+UCdOySgoReEnw1clMokuUQANAOYiZwoxv FtuiyDeUM4AbhtRfOg1a6l8OeEw/4t77qQUysweqBiSwu7ZoFVjm3f3USPtR8pNCwj qmeu4p5Py6A+1owVi3iSxgLfHMGCC45ua3jxuuuc= 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.16 101/161] crypto: inside-secure - do not process request if no command was issued Date: Thu, 24 May 2018 11:38:46 +0200 Message-Id: <20180524093030.508867139@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@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.16-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 @@ -490,6 +490,15 @@ handle_req: 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);