In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: btnxpuart: Resolve TX timeout error in power save stress test
This fixes the tx timeout issue seen while running a stress test on btnxpuart for couple of hours, such that the interval between two HCI commands coincide with the power save timeout value of 2 seconds.
Test procedure using bash script: <load btnxpuart.ko> hciconfig hci0 up //Enable Power Save feature hcitool -i hci0 cmd 3f 23 02 00 00 while (true) do hciconfig hci0 leadv sleep 2 hciconfig hci0 noleadv sleep 2 done
Error log, after adding few more debug prints: Bluetooth: btnxpuartqueueskb(): 01 0A 20 01 00 Bluetooth: hci0: Set UART break: on, status=0 Bluetooth: hci0: btnxpuarttxwakeup() txwork scheduled Bluetooth: hci0: btnxpuarttx_work() dequeue: 01 0A 20 01 00 Can't set advertise mode on hci0: Connection timed out (110) Bluetooth: hci0: command 0x200a tx timeout
When the power save mechanism turns on UART break, and btnxpuarttxwork() is scheduled simultaneously, psdata->psstate is read as PSSTATE_AWAKE, which prevents the psdata->work from being scheduled, which is responsible to turn OFF UART break.
This issue is fixed by adding a pslock mutex around UART break on/off as well as around psstate read/write. btnxpuarttxwakeup() will now read updated psstate value. If psstate is PSSTATESLEEP, it will first schedule psdata->work, and then it will reschedule itself once UART break has been turned off and psstate is PSSTATE_AWAKE.
Tested above script for 50,000 iterations and TX timeout error was not observed anymore.
[
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Function",
"digest": {
"function_hash": "42168960325370942307487759170310358991",
"length": 229.0
},
"target": {
"function": "ps_setup",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-4a959be9"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Function",
"digest": {
"function_hash": "261484796007129498028778464882869512468",
"length": 728.0
},
"target": {
"function": "btnxpuart_tx_work",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-4b57fd15"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Function",
"digest": {
"function_hash": "42168960325370942307487759170310358991",
"length": 229.0
},
"target": {
"function": "ps_setup",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-6cb14d52"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"293056288578534884600534309048196864563",
"101178622403632128900851818629573806760",
"269693164371808448942447221943519683645",
"254919653654653318607449809549484731133",
"286434028205806158010686745572224955004",
"268473128791398191213640226137770136089",
"54465506180642357843042057231836374534",
"233408549221868611564020938033907320114",
"153307161561408673246393126525040918149",
"124017557595684821474203154463332524466",
"105790678813323392576616509822824923963",
"333716065550884565757670238683414208906",
"107916733854916357099132240267944185490",
"148250237723270140614910334840002141560",
"278129327692278196654209800560496655641",
"3369029514333743190074653536772516845",
"86098899501475924232636957174885090477",
"77239277603187465337549442659397565743",
"102338389390921390991026068105210601433",
"117336550889962072181366043844949293047",
"290510975531349188385365687611268021157",
"7204660811075058318110881353529068363",
"122740363645468224374882080596420946587",
"22764075986812879853070880946490854711",
"83687044090978678692483112818720327900",
"159620399347212407378278493423894722996",
"153693702832967227531020984872329131680",
"308889717817652687452465533654729982999",
"150250249412593538575943081365089123639",
"74675128603489771260475900312814942509",
"303563547417184137907814617159566628907",
"141367784220512824446414387672022814419",
"36958217269175973006742138280896467381",
"241086169602605324223972393735261263844",
"84896951411320606294897260754017549446",
"310752756283054226218782008988511080479",
"66004376244227565477462961161567088930",
"218864327415672300843965160154759699965",
"47429216307423870714499889316802707502",
"124138408393049387535319062629391374148",
"129492634064332542081059777524730787679"
]
},
"target": {
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-71560f6f"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Function",
"digest": {
"function_hash": "29644226703926081070182221583965962794",
"length": 220.0
},
"target": {
"function": "ps_start_timer",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-88833ee1"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Function",
"digest": {
"function_hash": "37847531979255983788108832748334648015",
"length": 152.0
},
"target": {
"function": "nxp_dequeue",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-88fdd4e1"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Function",
"digest": {
"function_hash": "185604260803928452370948705231405388955",
"length": 181.0
},
"target": {
"function": "ps_wakeup",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-8a029208"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Function",
"digest": {
"function_hash": "185604260803928452370948705231405388955",
"length": 181.0
},
"target": {
"function": "ps_wakeup",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-8a69b759"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Function",
"digest": {
"function_hash": "29644226703926081070182221583965962794",
"length": 220.0
},
"target": {
"function": "ps_start_timer",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-927cfd4b"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"293056288578534884600534309048196864563",
"101178622403632128900851818629573806760",
"269693164371808448942447221943519683645",
"254919653654653318607449809549484731133",
"286434028205806158010686745572224955004",
"268473128791398191213640226137770136089",
"54465506180642357843042057231836374534",
"233408549221868611564020938033907320114",
"153307161561408673246393126525040918149",
"124017557595684821474203154463332524466",
"105790678813323392576616509822824923963",
"333716065550884565757670238683414208906",
"107916733854916357099132240267944185490",
"148250237723270140614910334840002141560",
"278129327692278196654209800560496655641",
"3369029514333743190074653536772516845",
"86098899501475924232636957174885090477",
"77239277603187465337549442659397565743",
"102338389390921390991026068105210601433",
"117336550889962072181366043844949293047",
"290510975531349188385365687611268021157",
"7204660811075058318110881353529068363",
"122740363645468224374882080596420946587",
"22764075986812879853070880946490854711",
"83687044090978678692483112818720327900",
"159620399347212407378278493423894722996",
"153693702832967227531020984872329131680",
"308889717817652687452465533654729982999",
"150250249412593538575943081365089123639",
"74675128603489771260475900312814942509",
"303563547417184137907814617159566628907",
"141367784220512824446414387672022814419",
"36958217269175973006742138280896467381",
"241086169602605324223972393735261263844",
"84896951411320606294897260754017549446",
"310752756283054226218782008988511080479",
"66004376244227565477462961161567088930",
"218864327415672300843965160154759699965",
"47429216307423870714499889316802707502",
"124138408393049387535319062629391374148",
"129492634064332542081059777524730787679"
]
},
"target": {
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-96b90d68"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Function",
"digest": {
"function_hash": "37847531979255983788108832748334648015",
"length": 152.0
},
"target": {
"function": "nxp_dequeue",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-9f12c16f"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9d5df94ce0e213d5b549633f528f96114c736190",
"signature_type": "Function",
"digest": {
"function_hash": "108965592008167808229000520709891038849",
"length": 790.0
},
"target": {
"function": "ps_control",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-a21e645d"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Function",
"digest": {
"function_hash": "108965592008167808229000520709891038849",
"length": 790.0
},
"target": {
"function": "ps_control",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-b7ea7855"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4db90e4eb8d5487098712ffb1048f3fa6d25e98",
"signature_type": "Function",
"digest": {
"function_hash": "261484796007129498028778464882869512468",
"length": 728.0
},
"target": {
"function": "btnxpuart_tx_work",
"file": "drivers/bluetooth/btnxpuart.c"
},
"id": "CVE-2024-58238-ed86677a"
}
]