В ядре Linux устранена следующая уязвимость:
usb: typec: ucsi: ccg: исправлено использование ucsi после освобождения при удалении. Поточный обработчик IRQ ccg_irq_handler() вызывает ucsi_notify_common(),
который в событии изменения соединителя вызывает ucsi_connector_change() и
планирует работу соединителя. В ucsi_ccg_remove() ucsi_destroy() освобождает
uc->ucsi (kfree) перед вызовом free_irq(), поэтому вызов обработчика
уже находящийся в полете может получить доступ к освобожденному объекту после ucsi_destroy().
ЦП 0 (удалить) | ЦП 1 (потоковое прерывание)
ucsi_destroy(uc->ucsi) | ccg_irq_handler()
kfree(ucsi) // БЕСПЛАТНО | ucsi_notify_common(uc->ucsi) // ИСПОЛЬЗОВАНИЕ
Переместите free_irq() перед ucsi_destroy() в пути удаления. Он сохраняется
после ucsi_unregister(): ucsi_unregister() отменяет работу коннектора,
обработчик выдает GET_CONNECTOR_STATUS через ucsi_send_command_common(),
который ожидает завершения, о котором сообщает обработчик IRQ, поэтому
IRQ должен оставаться активным до тех пор, пока эта работа не будет отменена. Путь ошибки зонда уже заказывает free_irq() перед ucsi_destroy().
Эту ошибку обнаружил статический анализ.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: usb: typec: ucsi: ccg: Fix use-after-free of ucsi on remove The threaded IRQ handler ccg_irq_handler() calls ucsi_notify_common(), which on a connector-change event calls ucsi_connector_change() and schedules connector work. In ucsi_ccg_remove(), ucsi_destroy() frees uc->ucsi (kfree) before free_irq() is called, so a handler invocation already in flight may access the freed object after ucsi_destroy(). CPU 0 (remove) | CPU 1 (threaded IRQ) ucsi_destroy(uc->ucsi) | ccg_irq_handler() kfree(ucsi) // FREE | ucsi_notify_common(uc->ucsi) // USE Move free_irq() before ucsi_destroy() in the remove path. It is kept after ucsi_unregister(): ucsi_unregister() cancels connector work whose handler issues GET_CONNECTOR_STATUS through ucsi_send_command_common(), which waits for a completion that is signalled from the IRQ handler, so the IRQ must stay active until that work has been cancelled. The probe error path already orders free_irq() before ucsi_destroy(). This bug was found by static analysis.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 9
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.5
|
5.10.261
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.212
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.178
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.145
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.96
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.39
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.1.4
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.2:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:7.2:rc2:*:*:*:*:*:*
|
— | — |