From patchwork Wed Oct 19 08:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp253666wrs; Wed, 19 Oct 2022 03:57:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xIl3WPQGvQnf8KsiSIHv0OHhXBOCMS6AroPO2ZxuWl2jV/EDvJ6eLhr69ePn6/ky4o+4O X-Received: by 2002:aa7:9a09:0:b0:562:64cc:94e0 with SMTP id w9-20020aa79a09000000b0056264cc94e0mr8029929pfj.60.1666177072096; Wed, 19 Oct 2022 03:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666177072; cv=none; d=google.com; s=arc-20160816; b=dlO2ChiuYHssvg5P2U8V5oNLIjQaqAtrUnVImKPrm746AgryX70WAorJQsqb8sYF+8 Yg98/4kAYRsG8+AR0W6+lY83EapSovCZtlExoiue2eevc2NyjYTASde2M/Veuwh09hbY og0uyk2/0JhJJP5efMnQNOVTWkCcZrA4CikbGQA9tZbrYA0VuMH/1eFZQU65AYZJoW0V AyvdddsbNQocV+CV6lu3QqCTPxwpCQGCZz3QPfL4z3XQtArA/Ros3ShWquyjfHiAoxD/ E39e99s5k5iDtvkStXJ2Zk/CxhnYFvDtBHjVZbsqVrgb5WSq08jNklE9S+7qX1ls5aJ6 UN7Q== 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=JwY9WW6++gXRXYeludyFLashQbZqhEj4BiDfYr+80sThS4U737cY/kP5GyzY3DBU6H hTYPPFvx872hWnc2rhkGw+rdwQyZvlxlupLx24qzaD1/tFJN3U1w5tWNnD5jvnao1U69 CO3cxx/1pxvh4awQrKKMPtMyS8jOQV554X7SikBs9oCP8EOuecvXKrxcI66gwcX1Qvp0 Mu8qICXoBX61Rn6/w7ic2b65QwrKzsSrKcq2iMpQhLlYA10aAHbJikF6x688eYfpHi44 GUQ3UkS9VpDBBdCfLRJ6GJ9yRE+h0cJ9NYcLA4oDuMSu4DPF9mtOe5o94RG608VDFb7H KsEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VdxQxcm6; 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 s13-20020a632c0d000000b00440fb4f79bdsi16063824pgs.9.2022.10.19.03.57.38; Wed, 19 Oct 2022 03:57:52 -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=VdxQxcm6; 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 S234771AbiJSK5O (ORCPT + 99 others); Wed, 19 Oct 2022 06:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234700AbiJSK4Z (ORCPT ); Wed, 19 Oct 2022 06:56:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB7B166994; Wed, 19 Oct 2022 03:27:44 -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 844B6B82497; Wed, 19 Oct 2022 09:08:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E495BC433D6; Wed, 19 Oct 2022 09:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170499; bh=HDYsHqlawLyMenwDf+zZ2I9OXsat/1lMky2g1FD+N7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VdxQxcm6HuDXEtYVpCYY/L3yZ2qc7jeLBrqvbGGzN6wM2220SlbWLKzj0S21L64mX U/YWzD69FFU/IQjc4We4hzwj94PwuIkQZhb88GYiBUJUQoFSELshj/jjMNizxdx9Ay aaef2j4gLKVCLfe1kLosbyVO/qXBJopiKGKyLPn0= 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 6.0 636/862] crypto: ccp - Release dma channels before dmaengine unrgister Date: Wed, 19 Oct 2022 10:32:03 +0200 Message-Id: <20221019083318.037257498@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747113289263548099?= X-GMAIL-MSGID: =?utf-8?q?1747113289263548099?= 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);