В ядре Linux устранена следующая уязвимость:
Bluetooth: qca: исправлена ошибка недостаточной длины тега NVM в анализаторе TLV. В ветви TLV_TYPE_NVM функции qca_tlv_check_data() граница цикла тегов равна
"пока (idx < длина - sizeof(struct tlv_type_nvm))". «длина» — это знак
int из заголовка TLV прошивки, а sizeof(struct tlv_type_nvm) — это
size_t (12), поэтому «длина» преобразуется в size_t и любую поставляемую прошивку.
«длина» < 12 приводит к тому, что вычитание превращается в огромное значение. Тело цикла
затем читает 12-байтовую структуру tlv_type_nvm после конца короткого
Буфер встроенного ПО vmalloc (и обработчики EDL_TAG_ID_* могут записывать данные мимо него).
Перепишите границу как «idx + sizeof(struct tlv_type_nvm) <= length»; оба
операнды неотрицательны, поэтому они больше не переполняются, а также "длина"
small для одной записи корректно пропускает цикл. ОШИБКА: KASAN: vmalloc-out-of-bounds в qca_download_firmware.isra.0 (drivers/bluetooth/btqca.c:421)
Чтение размера 2 по адресу ffffc900000e5004 с помощью задачи kworker/u9:0/52. Рабочая очередь: hci0 hci_power_on
Отслеживание вызова:
...
kasan_report (mm/kasan/report.c:595)
qca_download_firmware.isra.0 (drivers/bluetooth/btqca.c:421 driver/bluetooth/btqca.c:617)
qca_uart_setup (драйверы/bluetooth/btqca.c:948)
qca_setup (драйверы/bluetooth/hci_qca.c:2029)
hci_uart_setup (драйверы/bluetooth/hci_ldisc.c:438)
hci_dev_open_sync (net/bluetooth/hci_sync.c:5227)
hci_power_on (net/bluetooth/hci_core.c:920)
process_one_work (ядро/workqueue.c:3322)
рабочий_поток (ядро/workqueue.c:3486)
kthread (ядро/kthread.c:436)
ret_from_fork (arch/x86/kernel/process.c:158)
ret_from_fork_asm (arch/x86/entry/entry_64.S:245)
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: Bluetooth: qca: fix NVM tag length underflow in TLV parser In the TLV_TYPE_NVM branch of qca_tlv_check_data() the tag loop bound is "while (idx < length - sizeof(struct tlv_type_nvm))". "length" is a signed int from the firmware TLV header and sizeof(struct tlv_type_nvm) is a size_t (12), so "length" is converted to size_t and any firmware-supplied "length" < 12 makes the subtraction wrap to a huge value. The loop body then reads a 12-byte struct tlv_type_nvm past the end of the short vmalloc'd firmware buffer (and the EDL_TAG_ID_* handlers can write past it). Rewrite the bound as "idx + sizeof(struct tlv_type_nvm) <= length"; both operands are non-negative, so it no longer underflows and a "length" too small for one record correctly skips the loop. BUG: KASAN: vmalloc-out-of-bounds in qca_download_firmware.isra.0 (drivers/bluetooth/btqca.c:421) Read of size 2 at addr ffffc900000e5004 by task kworker/u9:0/52 Workqueue: hci0 hci_power_on Call Trace: ... kasan_report (mm/kasan/report.c:595) qca_download_firmware.isra.0 (drivers/bluetooth/btqca.c:421 drivers/bluetooth/btqca.c:617) qca_uart_setup (drivers/bluetooth/btqca.c:948) qca_setup (drivers/bluetooth/hci_qca.c:2029) hci_uart_setup (drivers/bluetooth/hci_ldisc.c:438) hci_dev_open_sync (net/bluetooth/hci_sync.c:5227) hci_power_on (net/bluetooth/hci_core.c:920) process_one_work (kernel/workqueue.c:3322) worker_thread (kernel/workqueue.c:3486) kthread (kernel/kthread.c:436) ret_from_fork (arch/x86/kernel/process.c:158) ret_from_fork_asm (arch/x86/entry/entry_64.S:245)