From patchwork Mon Oct 24 11:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp479092wru; Mon, 24 Oct 2022 07:18:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GdG+C0jBxTxCfpCASgQKzqlrTr6ALxL/okF4fNZD7aT90eaGTGGmGjfOAAshbG1EpP0rk X-Received: by 2002:a17:907:3f26:b0:78d:9c30:4529 with SMTP id hq38-20020a1709073f2600b0078d9c304529mr27651448ejc.195.1666621110336; Mon, 24 Oct 2022 07:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621110; cv=none; d=google.com; s=arc-20160816; b=pudmEJa5HhEoxRjKlR3ol39EaFpdFaQD+lJNRC6dybqRqvDNUuI82fygUXcdLQff2F MatsTAzvgyY2fCb9A3QQfdap1rtGtI+r7aZsIfB7ttvhFYAlyN5c9ky2rzV+GJZzVpZv Yp38pwZWHQz21zDVn/c/zeU+MOU5ROio2e65zTE73tV/6ia83fNPg838crZwxbZ77oEB 3H7GKvboct0qFKrm72w3Oh5suLuwxavU96f7t5uvCnUdE78h5YkmVZ6y2km+8JolnoNA 59cfmu6x1I/8Zh1+OQUGy84HPSflIIdjFvewGAESb0vjb/tmQ/gmsDuwXT3YMULS8DcU 2JCA== 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=nysfxJ7UVpTyjzJPy1Bi8R7CU7ruSpzx1er6uwuuzIha9kI+DIlkfJkix1wIEqtFLB Em+8Zod5IW1qc/bmxXBFay3IAhwaCUOHQqx63epGhhYzDX1jCyvGrrHYqx4vanSXU33X SmWxfSs/5HR70IloJCwPk8R2OCd+e8mdqwb/eVTolWEd9uwK1/5yRZ9ZrY45bWJbIHiK VKQfIwYOuwPQWU6JBXBvpBSiEI8OaF0ULrQ4RE+Y/7tCiCPKoePhVKcGfAiwse8Vcns6 Ml2YSVht5aowKYDqnU+94LjjmeKlGGpHK6hvHcWn9t02StBaCQgQW8XfX1ZnJ5HrL+r6 popQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W1s5muSd; 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 he6-20020a1709073d8600b0078d9c781853si29058539ejc.607.2022.10.24.07.18.00; Mon, 24 Oct 2022 07:18:30 -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=W1s5muSd; 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 S231860AbiJXOMr (ORCPT + 99 others); Mon, 24 Oct 2022 10:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236963AbiJXOJn (ORCPT ); Mon, 24 Oct 2022 10:09:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9F5AC5894; Mon, 24 Oct 2022 05:51:32 -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 dfw.source.kernel.org (Postfix) with ESMTPS id AA34B612E7; Mon, 24 Oct 2022 12:49:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B850CC433C1; Mon, 24 Oct 2022 12:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615788; bh=HDYsHqlawLyMenwDf+zZ2I9OXsat/1lMky2g1FD+N7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W1s5muSd4N5mhxgRMY10FO2cdJmzucshjC9F/T1VoiNCKGbX3dZilqKo/I10mpC2E +nk4Puab8ffIDrkHwVFWC9m/CnFKU81d97+0e6zhNSVwyitns7GACPEfNcRQxM0O4g Wx3xT1bVgPYLHGbE/TsDb7JU1UcNw205KCltveOE= 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.15 383/530] crypto: ccp - Release dma channels before dmaengine unrgister Date: Mon, 24 Oct 2022 13:32:07 +0200 Message-Id: <20221024113102.401233469@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747578897698649657?= X-GMAIL-MSGID: =?utf-8?q?1747578897698649657?= 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);