ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access

When snd_soc_card_jack_new is not called or the call fails,
calling this function causes a null pointer access

Signed-off-by: mnlife <mnlife@126.com>
Link: https://lore.kernel.org/r/20230811142511.6570-1-mnlife@126.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
mnlife 2023-08-11 22:25:11 +08:00 committed by Mark Brown
parent 273bc8bf22
commit 62cc82e648
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -37,7 +37,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
struct snd_soc_jack_pin *pin;
unsigned int sync = 0;
if (!jack)
if (!jack || !jack->jack)
return;
trace_snd_soc_jack_report(jack, mask, status);