From patchwork Thu May 18 13:29:26 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: 100102 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp721578qge; Thu, 18 May 2017 06:30:16 -0700 (PDT) X-Received: by 10.98.134.72 with SMTP id x69mr4627473pfd.106.1495114216583; Thu, 18 May 2017 06:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495114216; cv=none; d=google.com; s=arc-20160816; b=XTrtXVNEUgVF1LmBwlKZ+lp2PFZEQqkaC4QqdKAozUtZNweOlZ8y+VYKxM5pKYiIQp Dww0D4lknHOxZj1tCI1HSFtvGygNTZN4IXbeUcw5gNVQHbgUIHuin2P5/+Le8uc0CCSL okcfJ5vbLeiSH6p2RMetqufXFZsKSatb6Vtgs3cdfBwd6gISkvRYZROfl4zK40JPQnEb L7g3NnTrWaeSNeP9hxeASi2d0NVD79WnTSM5MYjGzGIUbrxUxSumioc9K7cC/22EOogW cQlFiZ5ObEsV9TsqjZ49GJiCcr9Ya4O9841GQvf9SVOQLyJgprmNbUxf/oe9bjhaa3iZ +rKQ== 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=sZEgKQi7fBW82PmT/KLOcySu+WpKIGDnhRjZ0UeS8mfJxWYLi0k/76NF3g+RIZwcm7 lGSzRJpnzxRyQK2BS+6RJ48kYyWgEPMu7Z3RS7oOTOTeBc/PA3NHNYwa5iqD+3eQ2hrq CvFnCw37oEdi0SwnvpGic1md1g73pDRksVx+5aj5ydkaifvy74z778Fpm+Zlojl9zIyW BKAV7HO51oXX9/AZVu/Dq7H8Be5y19BsM9mT81/Ylx0ltBKVZkL7gOuU7FXiPys8wJG1 0wiBvwu/PonsdZVxTyBKVLcdFTQjxwbU5ptQUIgPCtdXzly15OSbU5tWdy1BTXIZYJ6H rE1A== 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 h71si5100581pfe.101.2017.05.18.06.30.16; Thu, 18 May 2017 06:30:16 -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 S964834AbdERNaE (ORCPT + 25 others); Thu, 18 May 2017 09:30:04 -0400 Received: from foss.arm.com ([217.140.101.70]:60148 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934891AbdERN35 (ORCPT ); Thu, 18 May 2017 09:29:57 -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 98CB5165C; Thu, 18 May 2017 06:29:46 -0700 (PDT) Received: from gby.emea.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D3A463F3E1; Thu, 18 May 2017 06:29:44 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Jonathan Corbet , David Howells Cc: Ofir Drang , linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org Subject: [PATCH v2 4/4] crypto: Documentation: fix none signal safe sample Date: Thu, 18 May 2017 16:29:26 +0300 Message-Id: <1495114167-3073-5-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1495114167-3073-1-git-send-email-gilad@benyossef.com> References: <1495114167-3073-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);