Ad

CVE-2024-36894

HIGH CVSS 3.1: 7,8 EPSS 0.20%
Обновлено 15 октября 2026
Linux
Параметр Значение
CVSS 7,8 (HIGH)
Уязвимые версии 3.15 — 6.8.10
Устранено в версии 4.19.317
Тип уязвимости CWE-362 (Состояние гонки)
Поставщик Linux
Публичный эксплойт Нет

В ядре Linux устранена следующая уязвимость: USB: гаджет: f_fs: Исправлена гонка между aio_cancel() и завершением запроса AIO. Приложения на основе FFS могут использовать обратный вызов aio_cancel() для исключения из очереди. ожидающие запросы USB, отправленные в УДК. Существует сценарий, в котором Приложение FFS выдает вызов отмены AIO, в то время как UDC обрабатывает мягкое отключение.

Для реализации на основе DWC3 стек вызовов выглядит как следующее: Приложение DWC3 Gadget FFS dwc3_gadget_soft_disconnect() ... --> dwc3_stop_active_transfers() --> dwc3_gadget_giveback(-ESHUTDOWN) --> ffs_epfile_async_io_complete() ffs_aio_cancel() --> usb_ep_free_request() --> usb_ep_dequeue() В настоящее время между завершением AIO не реализована блокировка. обработчик и отмена AIO, поэтому проблема возникает, если процедура завершения работает параллельно с вызовом отмены AIO, поступающим из приложения FFS. Поскольку вызов завершения освобождает запрос USB (io_data->req), FFS приложение также ссылается на него для вызова usb_ep_dequeue(). Это может приведет к доступу к устаревшему/зависающему указателю. commit b566d38857fc («usb: гаджет: f_fs: последовательно используйте io_data->status») переместил usb_ep_free_request() в ffs_epfile_async_io_complete().

Однако, чтобы правильно реализовать блокировку для смягчения этой проблемы, спин-блокировку нельзя добавить в ffs_epfile_async_io_complete(), так как usb_ep_dequeue() (в случае успешного удаления запроса USB из очереди) вызовет обработчик завершения функционального драйвера в том же контексте. Следовательно, ведущий в тупик. Исправьте эту проблему, переместив usb_ep_free_request() обратно в ffs_user_copy_worker() и убедиться, что он явно устанавливает io_data->req в NULL после его освобождения в ffs->eps_lock.

Это решает гонку условие выше, поскольку процедура ffs_aio_cancel() не будет продолжена попытка исключить из очереди запрос, который уже освобожден, или ffs_user_copy_work() не освобождает запрос USB до тех пор, пока не будет отменена AIO закончил ссылаться на него. Это исправление зависит от commit b566d38857fc ("usb: гаджет: f_fs: используйте io_data->status последовательно")

Показать оригинальное описание (EN)

In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_fs: Fix race between aio_cancel() and AIO request complete FFS based applications can utilize the aio_cancel() callback to dequeue pending USB requests submitted to the UDC. There is a scenario where the FFS application issues an AIO cancel call, while the UDC is handling a soft disconnect. For a DWC3 based implementation, the callstack looks like the following: DWC3 Gadget FFS Application dwc3_gadget_soft_disconnect() ... --> dwc3_stop_active_transfers() --> dwc3_gadget_giveback(-ESHUTDOWN) --> ffs_epfile_async_io_complete() ffs_aio_cancel() --> usb_ep_free_request() --> usb_ep_dequeue() There is currently no locking implemented between the AIO completion handler and AIO cancel, so the issue occurs if the completion routine is running in parallel to an AIO cancel call coming from the FFS application. As the completion call frees the USB request (io_data->req) the FFS application is also referencing it for the usb_ep_dequeue() call. This can lead to accessing a stale/hanging pointer. commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently") relocated the usb_ep_free_request() into ffs_epfile_async_io_complete(). However, in order to properly implement locking to mitigate this issue, the spinlock can't be added to ffs_epfile_async_io_complete(), as usb_ep_dequeue() (if successfully dequeuing a USB request) will call the function driver's completion handler in the same context. Hence, leading into a deadlock. Fix this issue by moving the usb_ep_free_request() back to ffs_user_copy_worker(), and ensuring that it explicitly sets io_data->req to NULL after freeing it within the ffs->eps_lock. This resolves the race condition above, as the ffs_aio_cancel() routine will not continue attempting to dequeue a request that has already been freed, or the ffs_user_copy_work() not freeing the USB request until the AIO cancel is done referencing it. This fix depends on commit b566d38857fc ("usb: gadget: f_fs: use io_data->status consistently")

Характеристики атаки

Способ атаки
Локальный
Нужен локальный доступ
Сложность
Низкая
Легко эксплуатировать
Нужны права
Низкие
Нужны базовые права
Участие пользователя
Не требуется
Не нужно действие пользователя

Последствия

Конфиденциальность
Высокое
Полная утечка данных
Целостность
Высокое
Полная модификация данных
Доступность
Высокое
Полный отказ в обслуживании

Строка CVSS v3.1

Уязвимые продукты 13

Конфигурация От (включительно) До (исключительно)
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
3.15 4.19.317
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
4.20 5.4.279
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
5.5 5.10.221
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
5.11 5.15.162
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
5.16 6.1.95
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
6.2 6.6.31
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
6.7 6.8.10
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc4:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc5:*:*:*:*:*:*
— —
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.9:rc6:*:*:*:*:*:*
— —