* [PATCH v2 5.10.y] ASoC: rt7*-sdw: harden jack_detect_handler
@ 2026-11-20 23:16 Nobuhiro Iwamatsu
2026-11-21 15:27 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Nobuhiro Iwamatsu @ 2026-11-20 23:16 UTC (permalink / raw)
To: stable; +Cc: gregkh, sashal, Pierre-Louis Bossart, Mark Brown,
Nobuhiro Iwamatsu
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
commit 0484271ab0ce50649329fa9dc23c50853c5b26a4 upstream.
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>
[iwamatsu: Drop patch for sound/soc/codecs/rt711-sdca.c]
Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro.iwamatsu.x90@mail.toshiba>
---
sound/soc/codecs/rt700.c | 2 +-
sound/soc/codecs/rt711.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c
index 80acf0daabf8..7d221f93523b 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;
diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c
index 0e343ad205fc..e0117e576fd3 100644
--- a/sound/soc/codecs/rt711.c
+++ b/sound/soc/codecs/rt711.c
@@ -242,7 +242,7 @@ static void rt711_jack_detect_handler(struct work_struct *work)
if (!rt711->hs_jack)
return;
- if (!rt711->component->card->instantiated)
+ if (!rt711->component->card || !rt711->component->card->instantiated)
return;
reg = RT711_VERB_GET_PIN_SENSE | RT711_HP_OUT;
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-21 15:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 23:16 [PATCH v2 5.10.y] ASoC: rt7*-sdw: harden jack_detect_handler Nobuhiro Iwamatsu
2026-11-21 15:27 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox