В ядре Linux устранена следующая уязвимость:
Staging: media: ipu7: исправить ошибки двойного освобождения и использования после освобождения
И в ipu7_isys_init(), и в ipu7_psys_init() pdata выделяется и
затем передается в ipu7_bus_initialize_device(), который сохраняет его в
адев->pdata. Функция ipu7_bus_release() освобождает данные adev->pdata, когда
счетчик ссылок устройства падает до нуля. Два пути ошибки неправильно вызывают kfree(pdata) после отключения устройства
уже освободил его:
1.
При сбое ipu7_mmu_init() вызывается put_device(), который удаляет
счетчик ссылок обнуляется и вызывает ipu7_bus_release() ->
kfree(pdata). Последующий kfree(pdata) является двойным освобождением.
2. При сбое ipu7_bus_add_device(): он вызывает вспомогательную_device_uninit().
внутренне, который вызывает put_device() -> ipu7_bus_release() ->
kfree(pdata).
Последующий kfree(pdata) снова является двойным освобождением. Обратите внимание, что kfree(pdata) когда сам ipu7_bus_initialize_device()
error является правильным, потому что в этом случае вспомогательная_device_init() не удалась
и функция освобождения никогда не была настроена, поэтому pdata необходимо освободить
вручную. Кроме того, код ошибки не сохранялся перед вызовом put_device(),
заставляя ERR_CAST() разыменовывать уже освобожденный указатель adev при
построение возвращаемого значения.
Исправьте это, сохранив ошибку из
dev_err_probe() перед put_device() и вместо этого возвращает ERR_PTR(). Удалите лишние вызовы kfree(pdata) и исправьте use-after-free в
возвращаемые значения двух затронутых путей ошибок.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: staging: media: ipu7: fix double-free and use-after-free in error paths In both ipu7_isys_init() and ipu7_psys_init(), pdata is allocated and then passed to ipu7_bus_initialize_device(), which stores it in adev->pdata. The ipu7_bus_release() function frees adev->pdata when the device's reference count drops to zero. Two error paths incorrectly call kfree(pdata) after the device teardown has already freed it: 1. When ipu7_mmu_init() fails: put_device() is called, which drops the reference count to zero and triggers ipu7_bus_release() -> kfree(pdata). The subsequent kfree(pdata) is a double-free. 2. When ipu7_bus_add_device() fails: it calls auxiliary_device_uninit() internally, which calls put_device() -> ipu7_bus_release() -> kfree(pdata). The subsequent kfree(pdata) is again a double-free. Note that the kfree(pdata) when ipu7_bus_initialize_device() itself fails is correct, because in that case auxiliary_device_init() failed and the release function was never set up, so pdata must be freed manually. Additionally, the error code was not saved before calling put_device(), causing ERR_CAST() to dereference the already-freed adev pointer when constructing the return value. Fix this by saving the error from dev_err_probe() before put_device() and returning ERR_PTR() instead. Remove the redundant kfree(pdata) calls and fix the use-after-free in the return values of the two affected error paths.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 3
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.17
|
6.18.39
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.17
|
7.1.4
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.17
|
7.2
|