В ядре Linux устранена следующая уязвимость: usb: storage: realtek_cr: fix use-after-free on disconnect realtek_cr_destructor() вызывает timer_delete() до освобождения чипа, содержащего таймер. Обратный вызов таймера может все еще работать и может перевооружаться, в результате чего появляется use-after-free. Используйте timer_shutdown_sync(), чтобы дождаться обратного звонка и предотвратить дальнейшее перевооружение.
Сделайте это безоговорочно, потому что ss_en может быть изменен после того, как таймер вооружен. Переместите timer_setup() в init_realtek_cr(), чтобы таймер был инициализирован до того, как какой-либо путь отказа может вызвать деструктор. Обнаружено статическим анализом.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: usb: storage: realtek_cr: fix use-after-free on disconnect realtek_cr_destructor() calls timer_delete() before the chip containing the timer is freed. The timer callback may still be running and can rearm itself, resulting in a use-after-free. Use timer_shutdown_sync() to wait for the callback and prevent further rearming. Do this unconditionally because ss_en may be changed after the timer is armed. Move timer_setup() into init_realtek_cr() so the timer is initialized before any failure path can invoke the destructor. Found by static analysis.