In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: When HCI work queue is drained, only queue chained work
The HCI command, event, and data packet processing workqueue is drained to avoid deadlock in commit 76727c02c1e1 ("Bluetooth: Call drain_workqueue() before resetting state").
There is another delayed work, which will queue command to this drained workqueue. Which results in the following error report:
Bluetooth: hci2: command 0x040f tx timeout WARNING: CPU: 1 PID: 18374 at kernel/workqueue.c:1438 queuework+0xdad/0x1140 Workqueue: events hcicmdtimeout RIP: 0010:queuework+0xdad/0x1140 RSP: 0000:ffffc90002cffc60 EFLAGS: 00010093 RAX: 0000000000000000 RBX: ffff8880b9d3ec00 RCX: 0000000000000000 RDX: ffff888024ba0000 RSI: ffffffff814e048d RDI: ffff8880b9d3ec08 RBP: 0000000000000008 R08: 0000000000000000 R09: 00000000b9d39700 R10: ffffffff814f73c6 R11: 0000000000000000 R12: ffff88807cce4c60 R13: 0000000000000000 R14: ffff8880796d8800 R15: ffff8880796d8800 FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c0174b4000 CR3: 000000007cae9000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ? queueworkon+0xcb/0x110 ? lockdephardirqsoff+0x90/0xd0 queueworkon+0xee/0x110 processonework+0x996/0x1610 ? pwqdecnrinflight+0x2a0/0x2a0 ? rwlockbug.part.0+0x90/0x90 ? _rawspinlockirq+0x41/0x50 workerthread+0x665/0x1080 ? processonework+0x1610/0x1610 kthread+0x2e9/0x3a0 ? kthreadcompleteandexit+0x40/0x40 retfromfork+0x1f/0x30 </TASK>
To fix this, we can add a new HCIDRAINWQ flag, and don't queue the timeout workqueue while command workqueue is draining.
{ "vanir_signatures": [ { "id": "CVE-2022-50166-00dc657d", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bf367fa1fefabdf14938d0ac9ed60020389112e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 894.0, "function_hash": "257518447988808350207318989562596230190" }, "target": { "file": "net/bluetooth/hci_core.c", "function": "hci_cmd_work" } }, { "id": "CVE-2022-50166-115f25d3", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@877afadad2dce8aae1f2aad8ce47e072d4f6165e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 520.0, "function_hash": "144135601343006505313117936446615682189" }, "target": { "file": "net/bluetooth/hci_core.c", "function": "hci_dev_do_reset" } }, { "id": "CVE-2022-50166-33c240c4", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b382555706558f5c0587862b6dc03e96a252bba", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 520.0, "function_hash": "144135601343006505313117936446615682189" }, "target": { "file": "net/bluetooth/hci_core.c", "function": "hci_dev_do_reset" } }, { "id": "CVE-2022-50166-3a2c926b", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b382555706558f5c0587862b6dc03e96a252bba", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "298813293868886859514745344798933259469", "300600680245530625079093757460050561605", "92391027321936649602219980064911021975", "107957302026127153209846263830591235615", "143843955281711743296374900648421634852" ] }, "target": { "file": "net/bluetooth/hci_event.c" } }, { "id": "CVE-2022-50166-49082ede", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b382555706558f5c0587862b6dc03e96a252bba", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "132593684018331660663331178722641145623", "120667111050393162459976311001198937268", "19855078100547446904234493143941541294", "126964939899418083666355583488575929931" ] }, "target": { "file": "include/net/bluetooth/hci.h" } }, { "id": "CVE-2022-50166-4951c342", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@877afadad2dce8aae1f2aad8ce47e072d4f6165e", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "215689567160586635353936353189166886929", "256496434343241608840112733376569186170", "284410392486052775243610958670779163690", "265961021621483561569220838342860054336", "83303557863509254461739091128180501316", "302705192227592996511805174849857853200", "1830592253822661292996947604998412433", "206086635450207000340557044159757938533", "333679623362593137547654825798625450192", "97611935165721941957721845355791986827" ] }, "target": { "file": "net/bluetooth/hci_core.c" } }, { "id": "CVE-2022-50166-4e125f14", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bf367fa1fefabdf14938d0ac9ed60020389112e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 312.0, "function_hash": "286877488051970081752606841944560535560" }, "target": { "file": "net/bluetooth/hci_event.c", "function": "handle_cmd_cnt_and_timer" } }, { "id": "CVE-2022-50166-51ddc14e", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b382555706558f5c0587862b6dc03e96a252bba", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 894.0, "function_hash": "257518447988808350207318989562596230190" }, "target": { "file": "net/bluetooth/hci_core.c", "function": "hci_cmd_work" } }, { "id": "CVE-2022-50166-552a7770", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bf367fa1fefabdf14938d0ac9ed60020389112e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 520.0, "function_hash": "144135601343006505313117936446615682189" }, "target": { "file": "net/bluetooth/hci_core.c", "function": "hci_dev_do_reset" } }, { "id": "CVE-2022-50166-75e79e66", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b382555706558f5c0587862b6dc03e96a252bba", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "215689567160586635353936353189166886929", "256496434343241608840112733376569186170", "284410392486052775243610958670779163690", "265961021621483561569220838342860054336", "83303557863509254461739091128180501316", "302705192227592996511805174849857853200", "1830592253822661292996947604998412433", "206086635450207000340557044159757938533", "333679623362593137547654825798625450192", "97611935165721941957721845355791986827" ] }, "target": { "file": "net/bluetooth/hci_core.c" } }, { "id": "CVE-2022-50166-8218a5a2", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@877afadad2dce8aae1f2aad8ce47e072d4f6165e", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "298813293868886859514745344798933259469", "300600680245530625079093757460050561605", "92391027321936649602219980064911021975", "107957302026127153209846263830591235615", "143843955281711743296374900648421634852" ] }, "target": { "file": "net/bluetooth/hci_event.c" } }, { "id": "CVE-2022-50166-9328b2dc", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@877afadad2dce8aae1f2aad8ce47e072d4f6165e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 894.0, "function_hash": "257518447988808350207318989562596230190" }, "target": { "file": "net/bluetooth/hci_core.c", "function": "hci_cmd_work" } }, { "id": "CVE-2022-50166-9d01b066", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3b382555706558f5c0587862b6dc03e96a252bba", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 312.0, "function_hash": "286877488051970081752606841944560535560" }, "target": { "file": "net/bluetooth/hci_event.c", "function": "handle_cmd_cnt_and_timer" } }, { "id": "CVE-2022-50166-caa70f5a", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bf367fa1fefabdf14938d0ac9ed60020389112e", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "298813293868886859514745344798933259469", "300600680245530625079093757460050561605", "92391027321936649602219980064911021975", "107957302026127153209846263830591235615", "143843955281711743296374900648421634852" ] }, "target": { "file": "net/bluetooth/hci_event.c" } }, { "id": "CVE-2022-50166-e3aa1921", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bf367fa1fefabdf14938d0ac9ed60020389112e", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "132593684018331660663331178722641145623", "120667111050393162459976311001198937268", "19855078100547446904234493143941541294", "126964939899418083666355583488575929931" ] }, "target": { "file": "include/net/bluetooth/hci.h" } }, { "id": "CVE-2022-50166-f41b9a3d", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@877afadad2dce8aae1f2aad8ce47e072d4f6165e", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "132593684018331660663331178722641145623", "120667111050393162459976311001198937268", "19855078100547446904234493143941541294", "126964939899418083666355583488575929931" ] }, "target": { "file": "include/net/bluetooth/hci.h" } }, { "id": "CVE-2022-50166-fa97a6fa", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@877afadad2dce8aae1f2aad8ce47e072d4f6165e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "length": 312.0, "function_hash": "286877488051970081752606841944560535560" }, "target": { "file": "net/bluetooth/hci_event.c", "function": "handle_cmd_cnt_and_timer" } }, { "id": "CVE-2022-50166-fdb1a4e8", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4bf367fa1fefabdf14938d0ac9ed60020389112e", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "215689567160586635353936353189166886929", "256496434343241608840112733376569186170", "284410392486052775243610958670779163690", "265961021621483561569220838342860054336", "83303557863509254461739091128180501316", "302705192227592996511805174849857853200", "1830592253822661292996947604998412433", "206086635450207000340557044159757938533", "333679623362593137547654825798625450192", "97611935165721941957721845355791986827" ] }, "target": { "file": "net/bluetooth/hci_core.c" } } ] }