В ядре Linux устранена следующая уязвимость:
pwrseq: core: исправлено использование после освобождения в pwrseq_debugfs_seq_next()
pwrseq_debugfs_seq_next() объявляет «следующий» с помощью __free(put_device),
что вызывает вызов put_device() для возвращаемого указателя, когда
переменная выходит за пределы области видимости. Это приводит к использованию после бесплатного
поскольку структура seq_file получает указатель, ссылка на который имеет
уже сброшено. Простое удаление __free(put_device) исправит UAF, но приведет к утечке
ссылка, полученная с помощью bus_find_next_device(), только как stop()
вызывает up_read(&pwrseq_sem) и никогда не освобождает ссылку на устройство.
Исправьте это, сделав подсчет ссылок единообразным для всех
обратные вызовы seq_file, соответствующие стандартному шаблону, используемому PCI и
SCSI:
- start(): используйте get_device(), чтобы он возвращал указатель на ссылку.
- next(): явно put_device(curr) для освобождения предыдущего
ссылка на устройство (проверка NULL не требуется — структура seq_file
вызывает только next(), в то время как предыдущий возврат был отличным от NULL).
- stop(): put_device(data) для освобождения последнего итерированного устройства
ссылка с NULL-защитой, поскольку stop() может быть вызвана с NULL
когда start() вернул NULL или next() достиг конца последовательности.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: pwrseq: core: fix use-after-free in pwrseq_debugfs_seq_next() pwrseq_debugfs_seq_next() declares 'next' with __free(put_device), which causes put_device() to be called on the returned pointer when the variable goes out of scope. This results in a use-after-free since the seq_file framework receives a pointer whose reference has already been dropped. Simply removing __free(put_device) would fix the UAF but would leak the reference acquired by bus_find_next_device(), as stop() only calls up_read(&pwrseq_sem) and never releases the device reference. Fix this by making the reference counting consistent across all seq_file callbacks, matching the standard pattern used by PCI and SCSI: - start(): use get_device() so it returns a referenced pointer. - next(): explicitly put_device(curr) to release the previous device's reference (no NULL check needed - the seq_file framework only calls next() while the previous return was non-NULL). - stop(): put_device(data) to release the last iterated device's reference, with a NULL guard since stop() may be called with NULL when start() returned NULL or next() reached end-of-sequence.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 3
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.11
|
6.12.95
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.38
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.1.3
|