From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F02FC43381 for ; Wed, 27 Mar 2019 18:32:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 272AB20651 for ; Wed, 27 Mar 2019 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553711574; bh=776HbyHyvqD5bY7/lMiqR39wLK9StWacjT4+ZpxLPug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=g87hPM4RANjh2MbvQFJhTgd17P9ZsYBbJ/paX2f8LbV/EXhey74tvd4mC+tTK1d2y qMs66Tdtgp8VtLQHVbN50li7D+XtfqNQDPXGE3xcuEjlccFc7SJU6J9Kzy1Vei8Hks Q8k7jul/YPpLcb5qBiHXAGCREp/WzIHO4H0V6f2A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391926AbfC0Say (ORCPT ); Wed, 27 Mar 2019 14:30:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:45688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391649AbfC0S0G (ORCPT ); Wed, 27 Mar 2019 14:26:06 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 40D432184C; Wed, 27 Mar 2019 18:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553711166; bh=776HbyHyvqD5bY7/lMiqR39wLK9StWacjT4+ZpxLPug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ATCYsYv/SMMvyWsWqeR8BCYfVyrMaRTUQ21AaIVJ+2LzUYtSlPEOO1EQY8Jx2/rZd PuUw31ptI+x3jv6/naZRJdoU7cgNkD1S6QB9yb/ZieY1he0GN/g1NCT/jV9rfkJrkS KSYbPiiRy0TeSg/xcl2Q+Q49ztzfqMRk6eF+HrJw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ranjani Sridharan , Pierre-Louis Bossart , Takashi Iwai , Sasha Levin Subject: [PATCH AUTOSEL 3.18 23/41] ALSA: PCM: check if ops are defined before suspending PCM Date: Wed, 27 Mar 2019 14:25:00 -0400 Message-Id: <20190327182518.19394-23-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182518.19394-1-sashal@kernel.org> References: <20190327182518.19394-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ranjani Sridharan [ Upstream commit d9c0b2afe820fa3b3f8258a659daee2cc71ca3ef ] BE dai links only have internal PCM's and their substream ops may not be set. Suspending these PCM's will result in their ops->trigger() being invoked and cause a kernel oops. So skip suspending PCM's if their ops are NULL. [ NOTE: this change is required now for following the recent PCM core change to get rid of snd_pcm_suspend() call. Since DPCM BE takes the runtime carried from FE while keeping NULL ops, it can hit this bug. See details at: https://github.com/thesofproject/linux/pull/582 -- tiwai ] Signed-off-by: Ranjani Sridharan Signed-off-by: Pierre-Louis Bossart Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/pcm_native.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index afdb678cc757..14ea26291733 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1308,6 +1308,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm) /* FIXME: the open/close code should lock this as well */ if (substream->runtime == NULL) continue; + + /* + * Skip BE dai link PCM's that are internal and may + * not have their substream ops set. + */ + if (!substream->ops) + continue; + err = snd_pcm_suspend(substream); if (err < 0 && err != -EBUSY) return err; -- 2.19.1