Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5583658img; Wed, 27 Mar 2019 11:08:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPC5shNu0py+LMz1NDew133ONgfERB00SyZT/O2T5WzVnhKGmPFu3eZwztsm9T688Y/Kmr X-Received: by 2002:a62:1147:: with SMTP id z68mr35248381pfi.215.1553710113863; Wed, 27 Mar 2019 11:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553710113; cv=none; d=google.com; s=arc-20160816; b=IODlTTQIPPuuCZ+zNK5z27u1E8l2j1U7yZFFWelKf/Fy5fnZTTPnE5zzH+oheByMyR 9TD5v+PzYFbChhq/BLq9GNpe4pu32TPzTfkz3Eb1x6PzgqXPdRsgNyWH/RMZAa/ZYpE0 sQnA/KwHfYuqBQ9c2DgTqRxQd6Z037Efm8C3TJd2Db1vSQ4FaTeOiWn+inhJiRI+2/17 xEdDypP6Z9uWzAOswvVzxKOZQ2y06dcDXhrdijPJOxAOOT1N9CJolCs1nCRCVE236Kh0 6o3+lYBgC3eCuY3ax9b0w0FgoGDDv1ngleXfbbI4DuAFc98/NKxm6q0me0QJxqhN8Lgb KaeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WB8lfQpjeXU34UobXACktyREsYT6yMPd7DaS8mOWxG0=; b=SHWiDN2UWPmkxC3IUHeWHF3x0/i7iK2/XXwObGVxue5T3y+MnvpTV1JVVkGVA6wU7u gRF6CzCnJkFUnOTO/euajEw3/O8fAslPYkSRv+0WQ8gCo2iRqvnH2IZApW/nyDoEFrEF veXMBm3Dhpb1QkyFIuyu12fCOC6+hmSdEYHkI0EayjMPJKp4n1MECfB4u8HmmQZZW5UO 27I5ppaBbFvqaTA1PJAkhIVakGU0bbb5bxTAEHzQt6j7WiPmXVZMPcB+op7j6Z3tGv51 zuj3B1ll43MEvV0Pi6nkO0+RWOPJ93Zh6W8iAKDWMAMM9b99ZPLaSwLzsRf55DV94fJG lXRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rql0ji1D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck9si20768539plb.196.2019.03.27.11.08.18; Wed, 27 Mar 2019 11:08:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rql0ji1D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1732800AbfC0SG5 (ORCPT + 99 others); Wed, 27 Mar 2019 14:06:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388039AbfC0SGz (ORCPT ); Wed, 27 Mar 2019 14:06:55 -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 BE369217D9; Wed, 27 Mar 2019 18:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710014; bh=LJbHC8CUP9w6c6vvft2LeVztq6ZxNvVyK3i10enwjhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rql0ji1DwVsKD047bxIIAwmpD/LhwAYy+BDJRcUO+sqX/IWLitPE7BeK3aOEhduoK f2IZwT8bIMn/20q60NpUH2O+YfM0rK90iZL4cT6TL6GFt1NvzEP6mMg/D13z3bUfJW yG4JJ54Xne3e0nmRXXgYo5MJ61UcXrX1fTykD2Jg= 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 5.0 156/262] ALSA: PCM: check if ops are defined before suspending PCM Date: Wed, 27 Mar 2019 14:00:11 -0400 Message-Id: <20190327180158.10245-156-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-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 818dff1de545..b6e158ce6650 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1506,6 +1506,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