public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection
@ 2026-04-27  7:07 wangdich9700
  2026-04-27 11:35 ` Markus Elfring
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: wangdich9700 @ 2026-04-27  7:07 UTC (permalink / raw)
  To: perex, tiwai, wangdich9700; +Cc: kees, linux-sound, linux-kernel, wangdicheng

From: wangdicheng <wangdicheng@kylinos.cn>

In cx_probe(), the return value of snd_hda_jack_detect_enable_callback()
is ignored. If this function fails (e.g., due to memory allocation
failure), the driver continues to probe, but the jack detection callback
will not be registered. This can lead to a kernel crash later when the
driver attempts to handle jack events or accesses the uninitialized
structure.

Check the return value and propagate the error to the probe caller.

Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
---
 sound/hda/codecs/conexant.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
index 3a9717df39b4..4c01c6270bd3 100644
--- a/sound/hda/codecs/conexant.c
+++ b/sound/hda/codecs/conexant.c
@@ -1190,7 +1190,9 @@ static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
 	case 0x14f11f86:
 	case 0x14f11f87:
 		spec->is_cx11880_sn6140 = true;
-		snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
+		err = snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref);
+		if (err < 0)
+			goto error;
 		break;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-05-01  4:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27  7:07 [PATCH] ALSA: hda/conexant: Fix missing error check for jack detection wangdich9700
2026-04-27 11:35 ` Markus Elfring
2026-04-27 12:41 ` Takashi Iwai
2026-04-28 18:37 ` kernel test robot
2026-04-28 22:38 ` kernel test robot
2026-04-29 11:03 ` kernel test robot
2026-04-30 12:23 ` kernel test robot
2026-05-01  4:05 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox