Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp403885rwd; Wed, 14 Jun 2023 18:19:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pZQ1/vJ1Qq/2GuReklmZhUxwbgYbwvOhYsr7LHUIQwcBa7iuezgywkcnp5KEnWXKURuqF X-Received: by 2002:a05:6359:5a5:b0:128:b20b:925a with SMTP id ee37-20020a05635905a500b00128b20b925amr11015518rwb.9.1686791987153; Wed, 14 Jun 2023 18:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686791987; cv=none; d=google.com; s=arc-20160816; b=1C4AZUp5kaOnxgbPTnlbUb7whpguwLHxthjR6TD+lu10XLX3oS6iQGGarHLaQ53JW5 mX9nF58f084BVFmYpMoqgI/rMgEf10aj+gpO7E//cPzqjpvS1wDcwUX2Up8bn/egLlDO uY6X20mHUeWCFqIv0/0WKbKCz2cQnt/rv532WXGnYhhPD+2UPrEaMKyMoJSjwTi4sshE UcL6vkV0ghZbLH5ucVUA5DjotQxoOEALirBWS4HNBE19bi/tkTPMBB7S2q+GX6gJMrsi qnViFtWnZaJ6KITxY5XWyHE1JH3Ff5hl3F+/S3RcYYRt7PlRxmzRxhKcuB0cPP2YPLly Z2KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mzC+NqGud+m3RE2weIWhU8JbrmbjnvUh6gamGjEZ5ac=; b=G+xUXhTWYjDVI0kdIMsX+LqwL0PUxtQnZKnOP0yiwH3bLDuYxY2Tc4nt6TcXhuFnEM EprthQxBfVEIMaNWxmd9VNdFhtTk9mIrA9ZSZo7M/kQP0d6AGho7ZCnhBzX2SJLJxFY/ Ao408wGGe6CZ5n26ZDpdejDWHAsIle0/XYrUgQWQEiDYi726pjQE6bdAD8zL5CeZOkzL HWWkMfLJBkan/XxPc7kJVYQ5zpaDjPvy19H7sTvsNjlZlka/Sd+GAcnh3fdc/Bh35SW3 p5YjyUf76sdEfyMVti8fQS2Dv1tBGFgJOSl2zEzaDVVQo+Uf9IHDPMCKtUZpyjD/liU7 fF4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TB16isRp; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k76-20020a633d4f000000b0054fcdcbf4a3si2783887pga.142.2023.06.14.18.19.32; Wed, 14 Jun 2023 18:19:47 -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=@kernel.org header.s=k20201202 header.b=TB16isRp; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233018AbjFOA4s (ORCPT + 99 others); Wed, 14 Jun 2023 20:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbjFOA4p (ORCPT ); Wed, 14 Jun 2023 20:56:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11DB31BDB; Wed, 14 Jun 2023 17:56:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E19E63A1D; Thu, 15 Jun 2023 00:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B087C433C8; Thu, 15 Jun 2023 00:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686790604; bh=OKEogft+ftRPAL0ihwo9W+L1ntvp3tS05T85RJNv/Ic=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TB16isRpH8eDTfmvhjnt5myNDmbXdjsVb3iuxd02Rf66m14OEUXzv1/uuSxRMhQ9+ YV3R7OzC+vUUau3qUk1PD0zMiGiCMLw0Xz1WScBGutMhaAL9/t5uk03AuWFTVcKlWQ fXVbahDffF21ljddbldj8G3RjGvcSAD6OgPKOfIJF9V2KBfU4Izm4QdPr/jh9PJncM 4ki7qkwahsufDS9Aw3LlwphE5ZyY1QsBCkkXNqjhUCCeUF9T6kVRl2+WhrBvm3ICOp GaWNqHWLXn9xXo3qaRVDzW2tESKt0sXLs4u5DDZ1qPOIgh+st+kyj2DOtgrW6QVABA OEOelyRLHOjTA== Date: Thu, 15 Jun 2023 01:56:35 +0100 From: Mark Brown To: yixuanjiang Cc: vkoul@kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] ASoC: soc-compress: Fix deadlock in soc_compr_open_fe Message-ID: <92159f51-2e17-4c6b-8fd4-0bde8b1dd38a@sirena.org.uk> References: <20230613062350.271107-1-yixuanjiang@google.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yfBNAdUiVMRgFxH8" Content-Disposition: inline In-Reply-To: <20230613062350.271107-1-yixuanjiang@google.com> X-Cookie: You are false data. X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --yfBNAdUiVMRgFxH8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 13, 2023 at 02:23:50PM +0800, yixuanjiang wrote: > Modify the error handling flow by release lock. > The require pcm_mutex will keep holding if open fail. > +++ b/sound/soc/soc-compress.c > @@ -166,6 +166,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) > snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1); > out: > dpcm_path_put(&list); > + mutex_unlock(&fe->card->pcm_mutex); > be_err: This is really hard to follow due to the lack of any mutex_lock()s in the function, I think because this is intended to undo snd_soc_dpcm_mutex_lock(fe) but if that's the case why is it not using snd_soc_dpcm_mutex_unlock(fe) like the success path does? Given the use of classes not doing that looks like it'll create lockdep issues. I'd expect the unlock to match the lock. --yfBNAdUiVMRgFxH8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmSKYcMACgkQJNaLcl1U h9AIFAf+LLNgL9osk++AWzcSBDBByXr2ksUuFuAjK9f/R7G+Slh2/w7hotCeNbFh UxGQu0bkilmwhLUVwBbbyQhRCcXXJMXqDGBxbsVzJwwrq2Xw9IFlZx+Q2acg/Uce j4XoOPvrnxNXIld5kAJmoHmVLrnwppge9wT1T/Bof9a5SqhcDOqjuYYv/Vbcta2+ KgPHAe6hRQ1SGjTyoP4fwYfTyikTtiBP9S32dMDGCzcxFGTFXovVMFNeXDgMwSRf r8WH8jz8WD+dKuU3s39Wioe4AxWqDu7AsXOkU7zynAYlWDx8TvNOI0SVknZxpLf3 7ua6T/Hcp8DPaxgdmNjAkTTvG5Ferw== =zGKJ -----END PGP SIGNATURE----- --yfBNAdUiVMRgFxH8--