From patchwork Sat Oct 22 07:26:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106329wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46OotBaK6DEEwHqleT1hyiMna5fJgnucU6+Hq7Vds/dyoSClOImXscnGbM3v9CfWxzX8So X-Received: by 2002:a17:90b:4c86:b0:20d:8410:d829 with SMTP id my6-20020a17090b4c8600b0020d8410d829mr27644767pjb.146.1666427851477; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=NX1Yv48T1qoQsdN89ZYhAfLlLkJLqgzWZ5D/NIZya6Q4MixWhy7rQIwnAjcdsAaw54 ddLi9BtvUHcS04RljkMvzyEgG6F4gdOFvfSRubcxHcp0DIjCWtfHaLpd7MYVzNYHA485 z6/ejcCC7lci5dGruhQ8BGmABbPGVLUa8RDvi53qcWR+ZvyXAKqOhe3BKwdOxEx1jC1J 6UJ2ZIeKkpKcn6i7AokNhSXHUwfOnJ5mI1oFt6RsZkC1FNY0PFhwtRCVbbQ4cyT8UKJR Bb9F03SFnxaCNk8ja4qZOgA8uGvSHYPp27T/Fc2vgIGF11UHYBIyoRAHe2hCTnAcQNtp vjAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AThQeGQYCqQqT78FfOQVeY0zAyJGPYQUpAdkc3HP4j4=; b=urguvAaTIPpIyiwVNoDr8nQcJULkIS4jbCYxHJ+R6UEE+JsjLvx6VZJ5ycCUBL6Iz9 cDvleDlwA94AM93/HWyPhcBWI6ZilLVaVpHHSnW00XPqeEH7tKNLirbqE2GU3/FD2Zj7 /UYe1av2ne9CHzAiXC7rkVt1ncuL/7YtFbCA0F2wdtbVCLy9VfzFTzCQhsk/0wCJkIV/ Vhmc4LbaeS2NpWmHsrYrB5AQQJsUSD4MIyQeRT5mfCZ2YEJmQVGdQuiKowC4HYPqv8lk 6tV0LWvQ42n+bedSVdhyLCJxR3dDEb4O/fCith8+vqR1d45dbJ0ZeZHbS4u9ZzWIVA59 3mgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpqvMr9i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a170902f70700b001841134e3b1si27755764plo.160.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpqvMr9i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233818AbiJVIX3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233822AbiJVIVT (ORCPT ); Sat, 22 Oct 2022 04:21:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1686531371; Sat, 22 Oct 2022 00:58:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C3ED7B82DFE; Sat, 22 Oct 2022 07:58:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D1CBC433D6; Sat, 22 Oct 2022 07:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425494; bh=HDYsHqlawLyMenwDf+zZ2I9OXsat/1lMky2g1FD+N7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpqvMr9icWunlhIKz8Ze+yHt408fcULQQm6GfBFpptbMwod04e7/3S5LlIEJuMF+/ Gc/WYzuIuwyzH3fdy4LIqHNAFnyk2zxeN0pc9B95nOeWbyT+P7IsrhCL1KgWeEowCc dY+4Q6jADVwHx/mP5Ee+hiaW9Sgp9Y1wRRS/daOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Koba Ko , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 518/717] crypto: ccp - Release dma channels before dmaengine unrgister Date: Sat, 22 Oct 2022 09:26:37 +0200 Message-Id: <20221022072521.213056994@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376250600306214?= X-GMAIL-MSGID: =?utf-8?q?1747376250600306214?= From: Koba Ko [ Upstream commit 68dbe80f5b510c66c800b9e8055235c5b07e37d1 ] A warning is shown during shutdown, __dma_async_device_channel_unregister called while 2 clients hold a reference WARNING: CPU: 15 PID: 1 at drivers/dma/dmaengine.c:1110 __dma_async_device_channel_unregister+0xb7/0xc0 Call dma_release_channel for occupied channles before dma_async_device_unregister. Fixes: 54cce8ecb925 ("crypto: ccp - ccp_dmaengine_unregister release dma channels") Reported-by: kernel test robot Signed-off-by: Koba Ko Acked-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-dmaengine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index 7d4b4ad1db1f..9f753cb4f5f1 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -641,6 +641,10 @@ static void ccp_dma_release(struct ccp_device *ccp) for (i = 0; i < ccp->cmd_q_count; i++) { chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; + + if (dma_chan->client_count) + dma_release_channel(dma_chan); + tasklet_kill(&chan->cleanup_tasklet); list_del_rcu(&dma_chan->device_node); } @@ -766,8 +770,8 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp) if (!dmaengine) return; - dma_async_device_unregister(dma_dev); ccp_dma_release(ccp); + dma_async_device_unregister(dma_dev); kmem_cache_destroy(ccp->dma_desc_cache); kmem_cache_destroy(ccp->dma_cmd_cache);