Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2209965pxb; Fri, 25 Mar 2022 13:06:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrj6ZtnFUyIyUKyLdw7gmb3Ay2epnPZjfvcu1gQiIRjMgoMpdxvMR43y5fPBNxXraEPuSj X-Received: by 2002:a17:90b:1e4d:b0:1c7:467c:e229 with SMTP id pi13-20020a17090b1e4d00b001c7467ce229mr26464838pjb.52.1648238791826; Fri, 25 Mar 2022 13:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648238791; cv=none; d=google.com; s=arc-20160816; b=mKFY8WBD7rhMav+JglbsVRftP+oszulCvhrvL9N4whralOS6SPbAIBGyP4ybqE60CM mZHI3GwsL8Bysc05IMC5ikv0mdsPH5CXwOGATPhkIItwdzD4cR/FQ6u9HT/82FuQcLMQ q1CNwtXQs2va/5vnEXm95idJT5r16UZBzNlI0R7OYl0cIcgiXuV+NSbK3er5tuaMUpQN zqJKyD5BiZ4EToPvoHkXYOK5jlNH9s4iwYtx1+Dtou9xIxmFVvr6GjlpEuOFe9L8Ufda DJJYkQjZgr71A5pWpPTsrLe98hqOQXIawNR7NvEu2GDZPsY5DrHD9K+nifTLAvKgFF2s bwdw== 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=4rh7gMIioSodcO87WzFTKUuNIUlPl1tdI1YwIBeNdj4=; b=QVTvtfB1gY9Mw836hxRRR7OMskkWauDeP5Q7xBJt6xtPRB5WovBJfSKMjLK556/6BY bhw/0gxhaP+z++hBxIv4y+pICJ08qsRVrtVbkLFLtA3bZAHOJm2s0bukaFydbB6Ftw5V rEoqg70Ng8RoKM/2j/wDf7vTilLLVJc/KFMeiZNrAMcNc6nyr7Z5ubaW/198ITHWEV1v xTlOcUj15tkF11gvnmVOnyo0mKA8jB0Qz5uvzgZYDWsGasO0HoEcGxSnBgPmX+a7Em+/ FwmF/+4IdVOaUc+85xGGHBh+I4GIVga90xcjmFMUv7UCZDpacyIGOoh7tYqExefuIoG0 fT1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A6SdPMGf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 34-20020a631962000000b003816043efe5si3250941pgz.474.2022.03.25.13.06.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A6SdPMGf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B62C23754FC; Fri, 25 Mar 2022 11:49:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359705AbiCYPLH (ORCPT + 99 others); Fri, 25 Mar 2022 11:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359714AbiCYPJZ (ORCPT ); Fri, 25 Mar 2022 11:09:25 -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 4FACEDA6D1; Fri, 25 Mar 2022 08:07:17 -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 A5B5D61C11; Fri, 25 Mar 2022 15:07:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8702EC340E9; Fri, 25 Mar 2022 15:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648220836; bh=bOkJy+mMiLrQcWXHlmJVF/rdsYha53wcln9168+rGTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6SdPMGfp1lybz/CbABklehqtYnuH3h+OqEGviqbssroPlA+BuSDuzB2Lwzns1lRY 1EeoiynucHkXG6ExfdfKZeoIR9nTQKYhY3D0AzJjsof9htsPW2paP2uJPgLAYnxfL7 kxdPwe0T8cePFG8hH4Ug7hrpypMbrEg75OLBbLio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Palmer , Arnaud POULIQUEN , Takashi Iwai , Arnaud Pouliquen , Mark Brown Subject: [PATCH 4.19 07/20] ASoC: sti: Fix deadlock via snd_pcm_stop_xrun() call Date: Fri, 25 Mar 2022 16:04:45 +0100 Message-Id: <20220325150417.223100297@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150417.010265747@linuxfoundation.org> References: <20220325150417.010265747@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Takashi Iwai commit 455c5653f50e10b4f460ef24e99f0044fbe3401c upstream. This is essentially a revert of the commit dc865fb9e7c2 ("ASoC: sti: Use snd_pcm_stop_xrun() helper"), which converted the manual snd_pcm_stop() calls with snd_pcm_stop_xrun(). The commit above introduced a deadlock as snd_pcm_stop_xrun() itself takes the PCM stream lock while the caller already holds it. Since the conversion was done only for consistency reason and the open-call with snd_pcm_stop() to the XRUN state is a correct usage, let's revert the commit back as the fix. Fixes: dc865fb9e7c2 ("ASoC: sti: Use snd_pcm_stop_xrun() helper") Reported-by: Daniel Palmer Cc: Arnaud POULIQUEN Cc: Link: https://lore.kernel.org/r/20220315091319.3351522-1-daniel@0x0f.com Signed-off-by: Takashi Iwai Reviewed-by: Arnaud Pouliquen Link: https://lore.kernel.org/r/20220315164158.19804-1-tiwai@suse.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/sti/uniperif_player.c | 6 +++--- sound/soc/sti/uniperif_reader.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/sound/soc/sti/uniperif_player.c +++ b/sound/soc/sti/uniperif_player.c @@ -91,7 +91,7 @@ static irqreturn_t uni_player_irq_handle SET_UNIPERIF_ITM_BCLR_FIFO_ERROR(player); /* Stop the player */ - snd_pcm_stop_xrun(player->substream); + snd_pcm_stop(player->substream, SNDRV_PCM_STATE_XRUN); } ret = IRQ_HANDLED; @@ -105,7 +105,7 @@ static irqreturn_t uni_player_irq_handle SET_UNIPERIF_ITM_BCLR_DMA_ERROR(player); /* Stop the player */ - snd_pcm_stop_xrun(player->substream); + snd_pcm_stop(player->substream, SNDRV_PCM_STATE_XRUN); ret = IRQ_HANDLED; } @@ -138,7 +138,7 @@ static irqreturn_t uni_player_irq_handle dev_err(player->dev, "Underflow recovery failed\n"); /* Stop the player */ - snd_pcm_stop_xrun(player->substream); + snd_pcm_stop(player->substream, SNDRV_PCM_STATE_XRUN); ret = IRQ_HANDLED; } --- a/sound/soc/sti/uniperif_reader.c +++ b/sound/soc/sti/uniperif_reader.c @@ -65,7 +65,7 @@ static irqreturn_t uni_reader_irq_handle if (unlikely(status & UNIPERIF_ITS_FIFO_ERROR_MASK(reader))) { dev_err(reader->dev, "FIFO error detected\n"); - snd_pcm_stop_xrun(reader->substream); + snd_pcm_stop(reader->substream, SNDRV_PCM_STATE_XRUN); ret = IRQ_HANDLED; }