]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.35/asoc-intel-fix-crash-at-suspend-resume-after-failed-codec-registration.patch
Linux 4.19.35
[thirdparty/kernel/stable-queue.git] / releases / 4.19.35 / asoc-intel-fix-crash-at-suspend-resume-after-failed-codec-registration.patch
CommitLineData
8d82f256
GKH
1From 8f71370f4b02730e8c27faf460af7a3586e24e1f Mon Sep 17 00:00:00 2001
2From: Guenter Roeck <linux@roeck-us.net>
3Date: Fri, 22 Mar 2019 15:39:48 -0700
4Subject: ASoC: intel: Fix crash at suspend/resume after failed codec registration
5
6From: Guenter Roeck <linux@roeck-us.net>
7
8commit 8f71370f4b02730e8c27faf460af7a3586e24e1f upstream.
9
10If codec registration fails after the ASoC Intel SST driver has been probed,
11the kernel will Oops and crash at suspend/resume.
12
13general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
14CPU: 1 PID: 2811 Comm: cat Tainted: G W 4.19.30 #15
15Hardware name: GOOGLE Clapper, BIOS Google_Clapper.5216.199.7 08/22/2014
16RIP: 0010:snd_soc_suspend+0x5a/0xd21
17Code: 03 80 3c 10 00 49 89 d7 74 0b 48 89 df e8 71 72 c4 fe 4c 89
18fa 48 8b 03 48 89 45 d0 48 8d 98 a0 01 00 00 48 89 d8 48 c1 e8 03
19<8a> 04 10 84 c0 0f 85 85 0c 00 00 80 3b 00 0f 84 6b 0c 00 00 48 8b
20RSP: 0018:ffff888035407750 EFLAGS: 00010202
21RAX: 0000000000000034 RBX: 00000000000001a0 RCX: 0000000000000000
22RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff88805c417098
23RBP: ffff8880354077b0 R08: dffffc0000000000 R09: ffffed100b975718
24R10: 0000000000000001 R11: ffffffff949ea4a3 R12: 1ffff1100b975746
25R13: dffffc0000000000 R14: ffff88805cba4588 R15: dffffc0000000000
26FS: 0000794a78e91b80(0000) GS:ffff888068d00000(0000) knlGS:0000000000000000
27CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
28CR2: 00007bd5283ccf58 CR3: 000000004b7aa000 CR4: 00000000001006e0
29Call Trace:
30? dpm_complete+0x67b/0x67b
31? i915_gem_suspend+0x14d/0x1ad
32sst_soc_prepare+0x91/0x1dd
33? sst_be_hw_params+0x7e/0x7e
34dpm_prepare+0x39a/0x88b
35dpm_suspend_start+0x13/0x9d
36suspend_devices_and_enter+0x18f/0xbd7
37? arch_suspend_enable_irqs+0x11/0x11
38? printk+0xd9/0x12d
39? lock_release+0x95f/0x95f
40? log_buf_vmcoreinfo_setup+0x131/0x131
41? rcu_read_lock_sched_held+0x140/0x22a
42? __bpf_trace_rcu_utilization+0xa/0xa
43? __pm_pr_dbg+0x186/0x190
44? pm_notifier_call_chain+0x39/0x39
45? suspend_test+0x9d/0x9d
46pm_suspend+0x2f4/0x728
47? trace_suspend_resume+0x3da/0x3da
48? lock_release+0x95f/0x95f
49? kernfs_fop_write+0x19f/0x32d
50state_store+0xd8/0x147
51? sysfs_kf_read+0x155/0x155
52kernfs_fop_write+0x23e/0x32d
53__vfs_write+0x108/0x608
54? vfs_read+0x2e9/0x2e9
55? rcu_read_lock_sched_held+0x140/0x22a
56? __bpf_trace_rcu_utilization+0xa/0xa
57? debug_smp_processor_id+0x10/0x10
58? selinux_file_permission+0x1c5/0x3c8
59? rcu_sync_lockdep_assert+0x6a/0xad
60? __sb_start_write+0x129/0x2ac
61vfs_write+0x1aa/0x434
62ksys_write+0xfe/0x1be
63? __ia32_sys_read+0x82/0x82
64do_syscall_64+0xcd/0x120
65entry_SYSCALL_64_after_hwframe+0x49/0xbe
66
67In the observed situation, the problem is seen because the codec driver
68failed to probe due to a hardware problem.
69
70max98090 i2c-193C9890:00: Failed to read device revision: -1
71max98090 i2c-193C9890:00: ASoC: failed to probe component -1
72cht-bsw-max98090 cht-bsw-max98090: ASoC: failed to instantiate card -1
73cht-bsw-max98090 cht-bsw-max98090: snd_soc_register_card failed -1
74cht-bsw-max98090: probe of cht-bsw-max98090 failed with error -1
75
76The problem is similar to the problem solved with commit 2fc995a87f2e
77("ASoC: intel: Fix crash at suspend/resume without card registration"),
78but codec registration fails at a later point. At that time, the pointer
79checked with the above mentioned commit is already set, but it is not
80cleared if the device is subsequently removed. Adding a remove function
81to clear the pointer fixes the problem.
82
83Cc: stable@vger.kernel.org
84Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
85Cc: Curtis Malainey <cujomalainey@chromium.org>
86Signed-off-by: Guenter Roeck <linux@roeck-us.net>
87Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
88Signed-off-by: Mark Brown <broonie@kernel.org>
89Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
90
91---
92 sound/soc/intel/atom/sst-mfld-platform-pcm.c | 8 ++++++++
93 1 file changed, 8 insertions(+)
94
95--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
96+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
97@@ -711,9 +711,17 @@ static int sst_soc_probe(struct snd_soc_
98 return sst_dsp_init_v2_dpcm(component);
99 }
100
101+static void sst_soc_remove(struct snd_soc_component *component)
102+{
103+ struct sst_data *drv = dev_get_drvdata(component->dev);
104+
105+ drv->soc_card = NULL;
106+}
107+
108 static const struct snd_soc_component_driver sst_soc_platform_drv = {
109 .name = DRV_NAME,
110 .probe = sst_soc_probe,
111+ .remove = sst_soc_remove,
112 .ops = &sst_platform_ops,
113 .compr_ops = &sst_platform_compr_ops,
114 .pcm_new = sst_pcm_new,