Commit af1caa5
ALSA: hda: Fix headset detection failure due to unstable sort
stable inclusion
from stable-6.6.78
commit 3cef733e15cd8357bef2d713890a8d4884a990cc
category: bugfix
issue: #IC2PN8
CVE: NA
Signed-off-by: zyf1116 <[email protected]>
---------------------------------------
commit 3b4309546b48fc167aa615a2d881a09c0a97971f upstream.
The auto_parser assumed sort() was stable, but the kernel's sort() uses
heapsort, which has never been stable. After commit 0e02ca29a563
("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: b9030a0 ("ALSA: hda - Use standard sort function in hda_auto_parser.c")
Reported-by: Austrum <[email protected]>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219158
Tested-by: Austrum <[email protected]>
Cc: [email protected]
Signed-off-by: Kuan-Wei Chiu <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: zyf1116 <[email protected]>1 parent ca2442c commit af1caa5
2 files changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| 407 | + | |
| 408 | + | |
403 | 409 | | |
404 | 410 | | |
405 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
0 commit comments