From patchwork Thu May 11 11:53:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 99625 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp689566qge; Thu, 11 May 2017 04:54:31 -0700 (PDT) X-Received: by 10.99.8.193 with SMTP id 184mr12335522pgi.189.1494503671252; Thu, 11 May 2017 04:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494503671; cv=none; d=google.com; s=arc-20160816; b=Zd8zTlVZMxhp6PimFiAr3If8Kl+D1rwpfR0XqfD7FobkqX11wS0E7lF3D2QnkU0emy Qef5hbrhN7cfxHUtYfvhRD7RApn/FzCuLLImAa2QA4xNpNC7/y33MxkRJ0tlVhXX7gUm +nnp1WXHcFdKdf9bISb2PUjoGSK+JMsl6qYAtK4lQGGGBclUNjwkI5enmFJhbuMOxbpD 1g2qpEJhIC6p/BdqEJoINky2XX+zz9sIPhNHtHZZ0jNokWmkuMVd4KVFtev7SpcwdhAP PFKQDArA8uBTqp2501CxTO1HRWp/jYHOdN4rYfRCMim7YZ8t24ctmk1hRF3IyQaFmPcC CCIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=H4Oa5yGQHLP2xIRjq3lq1JBMkgjUYBZWe/kerarE91s=; b=e7BcCPgtJkjN7jk0jhirrxaRE8IHrhyp3SvoTRu8xj3pcqmsm4Pw87/+ExhnGNxfib 7W7hoRjBPNRCF7/uXqwcRgc5lm5wWbKt2/tHUcXgB00MHwLO6u3JT7crvkZ5E40DnKbR p8EjOwBBMMmoh28mKrJ9whbfmMIPi9bx7rXD5YO0YmsMoNaZ/4WOZrGBW9KnERDMa6V3 tpj6QbFYRVECSHNrxJrQqD4q+15CiIDJlBvBd/4x434B3gscuZ+EAfcqZsYfsy9d0WdI KLUNY71rpUw7ImkHnsLk0I9x2t3OrgNQkR0IpEUfrXkfmx2T4tnIjkEXSZ0OGXyaBO2q tKHQ== 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 v2si1663678pgv.316.2017.05.11.04.54.30; Thu, 11 May 2017 04:54:31 -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; 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 S932668AbdEKLyT (ORCPT + 25 others); Thu, 11 May 2017 07:54:19 -0400 Received: from foss.arm.com ([217.140.101.70]:46630 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932631AbdEKLyR (ORCPT ); Thu, 11 May 2017 07:54:17 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 060721516; Thu, 11 May 2017 04:54:12 -0700 (PDT) Received: from gby.kfn.arm.com (unknown [10.45.48.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60B593F4FF; Thu, 11 May 2017 04:54:09 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Jonathan Corbet , David Howells Cc: Ofir Drang , Gilad Ben-Yossef , Eric Biggers , linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org Subject: [PATCH 4/4] crypto: Documentation: fix none signal safe sample Date: Thu, 11 May 2017 14:53:45 +0300 Message-Id: <1494503626-15877-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1494503626-15877-1-git-send-email-gilad@benyossef.com> References: <1494503626-15877-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sample code was showing use of wait_for_completion_interruptible() for waiting for an async. crypto op to finish. However, if a signal arrived it would free the buffers used even while crypto HW might still DMA from/into the buffers. Resolve this by using wait_for_completion() instead. Reported-by: Eric Biggers Signed-off-by: Gilad Ben-Yossef --- Documentation/crypto/api-samples.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 diff --git a/Documentation/crypto/api-samples.rst b/Documentation/crypto/api-samples.rst index d021fd9..944f08b 100644 --- a/Documentation/crypto/api-samples.rst +++ b/Documentation/crypto/api-samples.rst @@ -48,7 +48,7 @@ Code Example For Symmetric Key Cipher Operation break; case -EINPROGRESS: case -EBUSY: - rc = wait_for_completion_interruptible( + rc = wait_for_completion( &sk->result.completion); if (!rc && !sk->result.err) { reinit_completion(&sk->result.completion);