From patchwork Fri Jan 27 23:09:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 9542867 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4B005601D7 for ; Fri, 27 Jan 2017 23:10:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D2E526E35 for ; Fri, 27 Jan 2017 23:10:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31AE427F9F; Fri, 27 Jan 2017 23:10:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1036826E35 for ; Fri, 27 Jan 2017 23:10:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750741AbdA0XKH (ORCPT ); Fri, 27 Jan 2017 18:10:07 -0500 Received: from mail-sn1nam01on0081.outbound.protection.outlook.com ([104.47.32.81]:52727 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750720AbdA0XKG (ORCPT ); Fri, 27 Jan 2017 18:10:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=U2/iRczR/4HSI1vrn5cZ2N8DubdB6X8BnwGLGy4uPYA=; b=DUFzOmXbEbghg3TfV3aCMMxBWe3rcpEwoQUwLly6Bq3a50KbzuRoSc8CvjAoH6bfqUt6bVu0cqi7qNINHqLD9dz0PD6X8KG1D3UzyULqukvvKmlRKlqC+jUWGcXxQLe/hXqW39Qx5bycv66IUnKfk4Uv/a7FM6rdUew70NtobGY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by BN6PR12MB1396.namprd12.prod.outlook.com (10.168.228.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Fri, 27 Jan 2017 23:09:17 +0000 Subject: [PATCH] crypto: ccp: Fix double add when creating new DMA command From: Gary R Hook To: CC: , , Date: Fri, 27 Jan 2017 17:09:04 -0600 Message-ID: <20170127230904.31399.58184.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR21CA0051.namprd21.prod.outlook.com (10.172.93.141) To BN6PR12MB1396.namprd12.prod.outlook.com (10.168.228.142) X-MS-Office365-Filtering-Correlation-Id: 9402dc3b-2232-460f-3809-08d447098509 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN6PR12MB1396; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1396; 3:KUl4u3J+sxeCcybETtYI/aihS6PtWfLrt6zIuoqQknMX80VesPswG1I4AAGuWIfa9Xd54dO0fsbZvbiP1Ov2IVcTl0B7v5LxguWaFjpMrkMvMuRlrUPK927Z+tQzlwYOCmLSiZtYQ3YOeop9ma1841vxkJaV6QLDj23Zw8aoOnlyPYAAGWdl+YuhHt1BP9fcZjqDcjcJG8eh+ivr2VZ+jZwu2g0GJIb3Jv5v5KsJHEDVV96aC+BnRk6TjD3UjzE4Z5XD+5Vs+hf/rR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B4T4RhSmWF0geEGB7GPJOOJcFCsarNv5FQc/Rn75ctEHE5EmrQQxNGrw8nS3UkW9o6ExgBveHj4N50csnwft+Xhh89LltmU1PtwBTz/jIfnJv3pUtxmEKGtg/WkaYpyxkODJvHdLOj1DpshwMhan/lF7gapzCJOM3882KE+W5XfdJFS/3uPbzgL6VpRdTJEU6nPXx/BnoiOiVloyVBvmdkEMAmlrS+byHt3HIDTGpV/vdQHVuVB69KTrrVH5c3L X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:BN6PR12MB1396; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1396; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1396; 4:ZxBqT/ZWEXgAATl33kzf/aXbazOaXIHujI9wNytwMWZiVI7xGLtpovCsH85rYT6XelpDqks5BiGhV7M6TqMCyyq9Xmqg6wpZI7YyvVi5lwPVgcRcsHk/3bNbJB5NpSE3dXL736IDyGSIFqMXOFk3kvS3Vgm0IMKDqNJci8iuTlqIOgx4F9E98MjpZ5I0khayxZnDwf7SWLM0zTj9lAaGHGporV5PsCwVLF8vkMzT+WgZgxYcm5KGHFxd8/Flz3UqFaRdC8d0XRdK7SWCIsPUA8sLKPhdXa81eyILXeJmr43esCxqOKDDrDae3H3VmOblE1Myxt6iNqHpijCXrGdeLKgErBG5wCVIrw0hiKC4MiTq4RlFM118zPEIZdhOv4lWuMb1m1F0acwHOW89+2LZmu3TWAPpo21zzP8mxtkCsIRbqcbTXxPUZ3UcRCuwYBjZqQm0tT2W92ANCamU1P6WAJi7jIDX8kbjANCZ6eDqfeSV0EvOO6sqqtRiFMfD3gGyu6d3iXH4xzS0M1fMtUJQEnDUD1Sm92tk+w/vK6g5o3sKlPHE/Xvo8AnW21nGxIz14lZMoALMe2qbR0nX6RzkxNbV15uLRzyj8dENJFkISTmNpQe/GQiMhIU2bXgx6fMD X-Forefront-PRVS: 0200DDA8BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(39410400002)(39850400002)(39860400002)(39840400002)(39450400003)(189002)(199003)(7736002)(189998001)(106356001)(42186005)(2351001)(81156014)(6666003)(38730400001)(110136003)(97746001)(6916009)(83506001)(86362001)(105586002)(90366009)(92566002)(50986999)(8676002)(33646002)(54906002)(47776003)(23676002)(33716001)(68736007)(1076002)(53936002)(2906002)(50466002)(103116003)(54356999)(66066001)(3846002)(25786008)(81166006)(6486002)(4326007)(230700001)(5660300001)(77096006)(4001350100001)(101416001)(6116002)(9686003)(97736004)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1396; H:[10.236.19.42]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMzk2OzIzOkdFbS9pTDdoZ2FxWEpyL0VCbUVKTEllVGsx?= =?utf-8?B?QjZSTGNreUtGOC9ubXY2d0h4OXhaNEYxTjV3SmZqOWFtODJoa1l5azZoZjRm?= =?utf-8?B?aHA1bGRmWHMvQ016ZjdldVdYVEd1a01vc3owbms5a0pSOUErQ0dCQWJiOWg3?= =?utf-8?B?bldCdXQ2dk5FS2NFS01DS1FqZ0RaTE91cFdEL2F5d3NPT2o2ekhIbmFQYzNB?= =?utf-8?B?b01oKzRkeDFwb2REd29QRVBMeHRmUkQ5eCtuQVUvMkc1YXh0Wm5ETU94R0d5?= =?utf-8?B?bjJ5UWV2RkVCeENINlJlck50YXkzL3h5bXFwaGo2YXI5ZzhwWUlsMUE3c2FT?= =?utf-8?B?L0YvMEZVNUo5ZWpYQnB6SEVYOU9IamphOUN6ZERGV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a7Y0f6B1negyzDh4kFFD5kikLU7zH3lGQpFjQ7jnHIch4s6Kd3J/+sm8h0iqec1i9X9zTPx027 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2017 23:09:17.0657 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1396 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Eliminate a double-add by creating a new list to manage command descriptors when created; move the descriptor to the pending list when the command is submitted. This Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev.h | 1 + drivers/crypto/ccp/ccp-dmaengine.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 830f35e..649e561 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h @@ -238,6 +238,7 @@ struct ccp_dma_chan { struct ccp_device *ccp; spinlock_t lock; + struct list_head created; struct list_head pending; struct list_head active; struct list_head complete; diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index 6553912..e5d9278 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -63,6 +63,7 @@ static void ccp_free_chan_resources(struct dma_chan *dma_chan) ccp_free_desc_resources(chan->ccp, &chan->complete); ccp_free_desc_resources(chan->ccp, &chan->active); ccp_free_desc_resources(chan->ccp, &chan->pending); + ccp_free_desc_resources(chan->ccp, &chan->created); spin_unlock_irqrestore(&chan->lock, flags); } @@ -273,6 +274,7 @@ static dma_cookie_t ccp_tx_submit(struct dma_async_tx_descriptor *tx_desc) spin_lock_irqsave(&chan->lock, flags); cookie = dma_cookie_assign(tx_desc); + list_del(&desc->entry); list_add_tail(&desc->entry, &chan->pending); spin_unlock_irqrestore(&chan->lock, flags); @@ -426,7 +428,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan, spin_lock_irqsave(&chan->lock, sflags); - list_add_tail(&desc->entry, &chan->pending); + list_add_tail(&desc->entry, &chan->created); spin_unlock_irqrestore(&chan->lock, sflags); @@ -610,6 +612,7 @@ static int ccp_terminate_all(struct dma_chan *dma_chan) /*TODO: Purge the complete list? */ ccp_free_desc_resources(chan->ccp, &chan->active); ccp_free_desc_resources(chan->ccp, &chan->pending); + ccp_free_desc_resources(chan->ccp, &chan->created); spin_unlock_irqrestore(&chan->lock, flags); @@ -679,6 +682,7 @@ int ccp_dmaengine_register(struct ccp_device *ccp) chan->ccp = ccp; spin_lock_init(&chan->lock); + INIT_LIST_HEAD(&chan->created); INIT_LIST_HEAD(&chan->pending); INIT_LIST_HEAD(&chan->active); INIT_LIST_HEAD(&chan->complete);