Skip to content

Commit a2d6d84

Browse files
jwrdegoedebroonie
authored andcommitted
ASoC: rt5640: Fix possible NULL pointer deref on resume
Commit 2b9c8d2 ("ASoC: rt5640: Add the HDA header support") adds re-queuing of the jack_work on resume when rt5640->jd_src != 0. But the jack_work will unconditionally deref rt5640->jack and that might be NULL. E.g. the sound/soc/intel/boards/bytcr_rt5640.c machine driver call snd_soc_component_set_jack(codec, NULL, NULL) from pre_suspend to disable the IRQ to avoid spurious wakeups, so when rt5640_resume() runs rt5640->jack will be NULL in this case. Make the queueing of the work conditional on rt5640->jack instead of on rt5640->jd_src to fix this. Fixes: 2b9c8d2 ("ASoC: rt5640: Add the HDA header support") Cc: Oder Chiou <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e4c35e7 commit a2d6d84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/soc/codecs/rt5640.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ static int rt5640_resume(struct snd_soc_component *component)
27372737
regcache_cache_only(rt5640->regmap, false);
27382738
regcache_sync(rt5640->regmap);
27392739

2740-
if (rt5640->jd_src) {
2740+
if (rt5640->jack) {
27412741
if (rt5640->jd_src == RT5640_JD_SRC_HDA_HEADER)
27422742
snd_soc_component_update_bits(component,
27432743
RT5640_DUMMY2, 0x1100, 0x1100);

0 commit comments

Comments
 (0)