Commit d26408df authored by Kuan-Wei Chiu's avatar Kuan-Wei Chiu Committed by Greg Kroah-Hartman
Browse files

ALSA: hda: Fix headset detection failure due to unstable sort



commit 3b430954 upstream.

The auto_parser assumed sort() was stable, but the kernel's sort() uses
heapsort, which has never been stable. After commit 0e02ca29
("lib/sort: optimize heapsort with double-pop variation"), the order of
equal elements changed, causing the headset to fail to work.

Fix the issue by recording the original order of elements before
sorting and using it as a tiebreaker for equal elements in the
comparison function.

Fixes: b9030a00 ("ALSA: hda - Use standard sort function in hda_auto_parser.c")
Reported-by: default avatarAustrum <austrum.lab@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219158


Tested-by: default avatarAustrum <austrum.lab@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarKuan-Wei Chiu <visitorckw@gmail.com>
Link: https://patch.msgid.link/20250128165415.643223-1-visitorckw@gmail.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e83b3f49
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment