diff mbox series

[v2] ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown

Message ID 20210205171428.2344210-1-ranjani.sridharan@linux.intel.com (mailing list archive)
State Accepted
Commit 45a2702ce10993eda7a5b12690294782d565519c
Headers show
Series [v2] ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown | expand

Commit Message

Ranjani Sridharan Feb. 5, 2021, 5:14 p.m. UTC
From: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>

During Coldboot stress tests, system encountered the following panic.
Panic logs depicts rt5682_i2c_shutdown() happened first and then later
jack detect handler workqueue function triggered.
This situation causes panic as rt5682_i2c_shutdown() resets codec.
Fix this panic by cancelling all jack detection delayed work.

Panic log:
[   20.936124] sof_pci_shutdown
[   20.940248] snd_sof_device_shutdown
[   20.945023] snd_sof_shutdown
[   21.126849] rt5682_i2c_shutdown
[   21.286053] rt5682_jack_detect_handler
[   21.291235] BUG: kernel NULL pointer dereference, address: 000000000000037c
[   21.299302] #PF: supervisor read access in kernel mode
[   21.305254] #PF: error_code(0x0000) - not-present page
[   21.311218] PGD 0 P4D 0
[   21.314155] Oops: 0000 [#1] PREEMPT SMP NOPTI
[   21.319206] CPU: 2 PID: 123 Comm: kworker/2:3 Tainted: G     U            5.4.68 #10
[   21.333687] ACPI: Preparing to enter system sleep state S5
[   21.337669] Workqueue: events_power_efficient rt5682_jack_detect_handler [snd_soc_rt5682]
[   21.337671] RIP: 0010:rt5682_jack_detect_handler+0x6c/0x279 [snd_soc_rt5682]

Fixes: a50067d4f3c1d ('ASoC: rt5682: split i2c driver into separate module')
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
Reviewed-by: Shuming Fan <shumingf@realtek.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

---
 sound/soc/codecs/rt5682-i2c.c | 3 +++
 1 file changed, 3 insertions(+)

Changelog
=========
v1 -> v2: cancel both jack detection work

Comments

Mark Brown Feb. 8, 2021, 6:38 p.m. UTC | #1
On Fri, 5 Feb 2021 09:14:28 -0800, Ranjani Sridharan wrote:
> During Coldboot stress tests, system encountered the following panic.
> Panic logs depicts rt5682_i2c_shutdown() happened first and then later
> jack detect handler workqueue function triggered.
> This situation causes panic as rt5682_i2c_shutdown() resets codec.
> Fix this panic by cancelling all jack detection delayed work.
> 
> Panic log:
> [   20.936124] sof_pci_shutdown
> [   20.940248] snd_sof_device_shutdown
> [   20.945023] snd_sof_shutdown
> [   21.126849] rt5682_i2c_shutdown
> [   21.286053] rt5682_jack_detect_handler
> [   21.291235] BUG: kernel NULL pointer dereference, address: 000000000000037c
> [   21.299302] #PF: supervisor read access in kernel mode
> [   21.305254] #PF: error_code(0x0000) - not-present page
> [   21.311218] PGD 0 P4D 0
> [   21.314155] Oops: 0000 [#1] PREEMPT SMP NOPTI
> [   21.319206] CPU: 2 PID: 123 Comm: kworker/2:3 Tainted: G     U            5.4.68 #10
> [   21.333687] ACPI: Preparing to enter system sleep state S5
> [   21.337669] Workqueue: events_power_efficient rt5682_jack_detect_handler [snd_soc_rt5682]
> [   21.337671] RIP: 0010:rt5682_jack_detect_handler+0x6c/0x279 [snd_soc_rt5682]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown
      commit: 45a2702ce10993eda7a5b12690294782d565519c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c
index 37d13120f5ba..93c1603b42f1 100644
--- a/sound/soc/codecs/rt5682-i2c.c
+++ b/sound/soc/codecs/rt5682-i2c.c
@@ -273,6 +273,9 @@  static void rt5682_i2c_shutdown(struct i2c_client *client)
 {
 	struct rt5682_priv *rt5682 = i2c_get_clientdata(client);
 
+	cancel_delayed_work_sync(&rt5682->jack_detect_work);
+	cancel_delayed_work_sync(&rt5682->jd_check_work);
+
 	rt5682_reset(rt5682);
 }