linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Gyeongtaek Lee <gt82.lee@samsung.com>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
	alsa-devel@alsa-project.org
Subject: [PATCH AUTOSEL 5.12 051/116] ASoC: soc-compress: lock pcm_mutex to resolve lockdep error
Date: Wed,  5 May 2021 12:30:19 -0400	[thread overview]
Message-ID: <20210505163125.3460440-51-sashal@kernel.org> (raw)
In-Reply-To: <20210505163125.3460440-1-sashal@kernel.org>

From: Gyeongtaek Lee <gt82.lee@samsung.com>

[ Upstream commit 45475bf60cc1d42da229a0aa757180c88bab8d22 ]

If panic_on_warn=1 is added in bootargs and compress offload playback with
DPCM is started, kernel panic would be occurred because rtd->card->pcm_mutex
isn't held in soc_compr_open_fe() and soc_compr_free_fe() and it generates
lockdep warning in the following code.

void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
			    int stream, int action)
{
	struct snd_soc_dai *dai;
	int i;

	lockdep_assert_held(&rtd->card->pcm_mutex);

To prevent lockdep warning but minimize side effect by adding mutex,
pcm_mutex is held just before snd_soc_runtime_activate() and
snd_soc_runtime_deactivate() and is released right after them.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
Link: https://lore.kernel.org/r/1891546521.01617772502282.JavaMail.epsvc@epcpadp3
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/soc-compress.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 246a5e32e22a..b4810266f5e5 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -153,7 +153,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
 	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
 	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
 
+	mutex_lock_nested(&fe->card->pcm_mutex, fe->card->pcm_subclass);
 	snd_soc_runtime_activate(fe, stream);
+	mutex_unlock(&fe->card->pcm_mutex);
 
 	mutex_unlock(&fe->card->mutex);
 
@@ -181,7 +183,9 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
 
 	mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
 
+	mutex_lock_nested(&fe->card->pcm_mutex, fe->card->pcm_subclass);
 	snd_soc_runtime_deactivate(fe, stream);
+	mutex_unlock(&fe->card->pcm_mutex);
 
 	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
 
-- 
2.30.2


  parent reply	other threads:[~2021-05-05 16:34 UTC|newest]

Thread overview: 119+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 16:29 [PATCH AUTOSEL 5.12 001/116] ath11k: fix thermal temperature read Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 002/116] ALSA: usb-audio: Add Pioneer DJM-850 to quirks-table Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 003/116] fs: dlm: fix debugfs dump Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 004/116] fs: dlm: fix mark setting deadlock Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 005/116] fs: dlm: add errno handling to check callback Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 006/116] fs: dlm: add check if dlm is currently running Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 007/116] fs: dlm: change allocation limits Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 008/116] fs: dlm: check on minimum msglen size Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 009/116] fs: dlm: flush swork on shutdown Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 010/116] fs: dlm: add shutdown hook Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 011/116] tipc: convert dest node's address to network order Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 012/116] ASoC: Intel: bytcr_rt5640: Enable jack-detect support on Asus T100TAF Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 013/116] net/mlx5e: Use net_prefetchw instead of prefetchw in MPWQE TX datapath Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 014/116] net: stmmac: Set FIFO sizes for ipq806x Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 015/116] ASoC: rsnd: core: Check convert rate in rsnd_hw_params Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 016/116] Documentation: networking: switchdev: fix command for static FDB entries Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 017/116] Bluetooth: Fix incorrect status handling in LE PHY UPDATE event Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 018/116] i2c: bail out early when RDWR parameters are wrong Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 019/116] ALSA: hdsp: don't disable if not enabled Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 020/116] ALSA: hdspm: " Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 021/116] ALSA: rme9652: " Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 022/116] ALSA: bebob: enable to deliver MIDI messages for multiple ports Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 023/116] Bluetooth: Set CONF_NOT_COMPLETE as l2cap_chan default Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 024/116] Bluetooth: verify AMP hci_chan before amp_destroy Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 025/116] Bluetooth: initialize skb_queue_head at l2cap_chan_create() Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 026/116] net/sched: cls_flower: use ntohs for struct flow_dissector_key_ports Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 027/116] net: bridge: when suppression is enabled exclude RARP packets Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 028/116] Bluetooth: check for zapped sk before connecting Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 029/116] selftests/powerpc: Fix L1D flushing tests for Power10 Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 030/116] ALSA: hda/hdmi: fix max DP-MST dev_num for Intel TGL+ platforms Sasha Levin
2021-05-05 16:29 ` [PATCH AUTOSEL 5.12 031/116] powerpc/32: Statically initialise first emergency context Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 032/116] net: hns3: remediate a potential overflow risk of bd_num_list Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 033/116] net: hns3: add handling for xmit skb with recursive fraglist Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 034/116] ip6_vti: proper dev_{hold|put} in ndo_[un]init methods Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 035/116] can: dev: can_free_echo_skb(): don't crash the kernel if can_priv::echo_skb is accessed out of bounds Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 036/116] iommu/arm-smmu-v3: Add a check to avoid invalid iotlb sync Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 037/116] ASoC: Intel: bytcr_rt5640: Add quirk for the Chuwi Hi8 tablet Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 038/116] ice: handle increasing Tx or Rx ring sizes Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 039/116] KVM: arm64: Use BUG and BUG_ON in nVHE hyp Sasha Levin
2021-05-05 16:49   ` Marc Zyngier
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 040/116] net: usb: ax88179_178a: initialize local variables before use Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 041/116] Bluetooth: btusb: Enable quirk boolean flag for Mediatek Chip Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 042/116] ASoC: rt5670: Add a quirk for the Dell Venue 10 Pro 5055 Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 043/116] selftests: mptcp: launch mptcp_connect with timeout Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 044/116] i2c: Add I2C_AQ_NO_REP_START adapter quirk Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 045/116] Bluetooth: Do not set cur_adv_instance in adv param MGMT request Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 046/116] MIPS: Loongson64: Use _CACHE_UNCACHED instead of _CACHE_UNCACHED_ACCELERATED Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 047/116] coresight: Do not scan for graph if none is present Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 048/116] IB/hfi1: Correct oversized ring allocation Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 049/116] mac80211: Set priority and queue mapping for injected frames Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 050/116] mac80211: clear the beacon's CRC after channel switch Sasha Levin
2021-05-05 16:30 ` Sasha Levin [this message]
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 052/116] net: phy: make PHY PM ops a no-op if MAC driver manages PHY PM Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 053/116] net: fec: use mac-managed " Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 054/116] pinctrl: samsung: use 'int' for register masks in Exynos Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 055/116] rtw88: 8822c: add LC calibration for RTL8822C Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 056/116] mt76: mt7615: fix key set/delete issues Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 057/116] mt76: mt7615: support loading EEPROM for MT7613BE Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 058/116] mt76: mt76x0: disable GTK offloading Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 059/116] mt76: connac: always check return value from mt76_connac_mcu_alloc_wtbl_req Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 060/116] mt76: mt7915: always check return value from mt7915_mcu_alloc_wtbl_req Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 061/116] mt76: mt7915: fix key set/delete issue Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 062/116] mt76: mt7915: fix txpower init for TSSI off chips Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 063/116] mt76: mt7921: fix key set/delete issue Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 064/116] mt76: mt7915: add wifi subsystem reset Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 065/116] i2c: imx: Fix PM reference leak in i2c_imx_reg_slave() Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 066/116] fuse: invalidate attrs when page writeback completes Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 067/116] virtiofs: fix userns Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 068/116] cuse: prevent clone Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 069/116] iwlwifi: pcie: make cfg vs. trans_cfg more robust Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 070/116] iwlwifi: queue: avoid memory leak in reset flow Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 071/116] iwlwifi: trans/pcie: defer transport initialisation Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 072/116] powerpc/mm: Add cond_resched() while removing hpte mappings Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 073/116] ASoC: rsnd: call rsnd_ssi_master_clk_start() from rsnd_ssi_init() Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 074/116] net: bridge: propagate error code and extack from br_mc_disabled_update Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 075/116] Revert "iommu/amd: Fix performance counter initialization" Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 076/116] iommu/amd: Remove performance counter pre-initialization test Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 077/116] drm/amd/display: Force vsync flip when reconfiguring MPCC Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 078/116] selftests: Set CC to clang in lib.mk if LLVM is set Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 079/116] kconfig: nconf: stop endless search loops Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 080/116] ALSA: hda/realtek: Add quirk for Lenovo Ideapad S740 Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 081/116] ASoC: Intel: sof_sdw: add quirk for new ADL-P Rvp Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 082/116] ALSA: hda/hdmi: fix race in handling acomp ELD notification at resume Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 083/116] i2c: i801: Add support for Intel Alder Lake PCH-M Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 084/116] sctp: Fix out-of-bounds warning in sctp_process_asconf_param() Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 085/116] flow_dissector: Fix out-of-bounds warning in __skb_flow_bpf_to_target() Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 086/116] powerpc/xive: Use the "ibm, chip-id" property only under PowerNV Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 087/116] powerpc/smp: Set numa node before updating mask Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 088/116] wilc1000: Bring MAC address setting in line with typical Linux behavior Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 089/116] mac80211: properly drop the connection in case of invalid CSA IE Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 090/116] ASoC: rt286: Generalize support for ALC3263 codec Sasha Levin
2021-05-07  4:34   ` David Ward
2021-05-14 13:04     ` Sasha Levin
2021-05-05 16:30 ` [PATCH AUTOSEL 5.12 091/116] ethtool: ioctl: Fix out-of-bounds warning in store_link_ksettings_for_user() Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 092/116] net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 093/116] samples/bpf: Fix broken tracex1 due to kprobe argument change Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 094/116] powerpc/pseries: Stop calling printk in rtas_stop_self() Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 095/116] drm/amd/display: fixed divide by zero kernel crash during dsc enablement Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 096/116] drm/amd/display: add handling for hdcp2 rx id list validation Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 097/116] drm/amdgpu: Add mem sync flag for IB allocated by SA Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 098/116] mt76: mt7615: fix entering driver-own state on mt7663 Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 099/116] crypto: ccp: Free SEV device if SEV init fails Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 100/116] wl3501_cs: Fix out-of-bounds warnings in wl3501_send_pkt Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 101/116] wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 102/116] qtnfmac: Fix possible buffer overflow in qtnf_event_handle_external_auth Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 103/116] powerpc/iommu: Annotate nested lock for lockdep Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 104/116] iavf: remove duplicate free resources calls Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 105/116] net: ethernet: mtk_eth_soc: fix RX VLAN offload Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 106/116] selftests: mlxsw: Increase the tolerance of backlog buildup Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 107/116] selftests: mlxsw: Fix mausezahn invocation in ERSPAN scale test Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 108/116] kbuild: generate Module.symvers only when vmlinux exists Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 109/116] bnxt_en: Add PCI IDs for Hyper-V VF devices Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 110/116] ia64: module: fix symbolizer crash on fdescr Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 111/116] watchdog: rename __touch_watchdog() to a better descriptive name Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 112/116] watchdog: explicitly update timestamp when reporting softlockup Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 113/116] watchdog/softlockup: report the overall time of softlockups Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 114/116] watchdog/softlockup: remove logic that tried to prevent repeated reports Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 115/116] watchdog: fix barriers when printing backtraces from all CPUs Sasha Levin
2021-05-05 16:31 ` [PATCH AUTOSEL 5.12 116/116] watchdog: cleanup handling of false positives Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505163125.3460440-51-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=gt82.lee@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).