diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2022-06-06 22:37:50 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-06-07 21:37:30 +0200 |
commit | 05ba4c00fa9cb077a0dd91f5e6056951a787f63c (patch) | |
tree | 1c88cb059c616be38cdc986d58d11c5dcd96991f /sound/soc/codecs/rt700.c | |
parent | ASoC: rt711: fix calibrate mutex initialization (diff) | |
download | linux-05ba4c00fa9cb077a0dd91f5e6056951a787f63c.tar.xz linux-05ba4c00fa9cb077a0dd91f5e6056951a787f63c.zip |
ASoC: rt7*-sdw: harden jack_detect_handler
Realtek headset codec drivers typically check if the card is
instantiated before proceeding with the jack detection.
The rt700, rt711 and rt711-sdca are however missing a check on the
card pointer, which can lead to NULL dereferences encountered in
driver bind/unbind tests.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220606203752.144159-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt700.c')
-rw-r--r-- | sound/soc/codecs/rt700.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c index af32295fa9b9..4a99d5f4706f 100644 --- a/sound/soc/codecs/rt700.c +++ b/sound/soc/codecs/rt700.c @@ -162,7 +162,7 @@ static void rt700_jack_detect_handler(struct work_struct *work) if (!rt700->hs_jack) return; - if (!rt700->component->card->instantiated) + if (!rt700->component->card || !rt700->component->card->instantiated) return; reg = RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT; |