В ядре Linux устранена следующая уязвимость: net/mlx5: E-Switch: исправить use-after-free в mlx5_eswitch_termtbl_put In mlx5_eswitch_termtbl_put(), проверка очистки с нулевым рефом читает tt->ref_count после выхода termtbl_mutex. Два одновременных абонента в одной и той же гонке mlx5_termtbl_handle: один уменьшает ref_count до нуля, удаляет хеш-запись и вызывает kfree(tt), в то время как другой уже сбросил мьютекс и собирается оценить, если (!tt->ref_count), производя use-after-free. Исправьте это, захватив результат декремента в последнюю переменную стека, прежде чем сбрасывать мьютекс.
Решение об очистке теперь принимается полностью под termtbl_mutex, и tt не затрагивается после kfree.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/mlx5: E-Switch: fix use-after-free in mlx5_eswitch_termtbl_put In mlx5_eswitch_termtbl_put(), the zero-ref cleanup check reads tt->ref_count after termtbl_mutex has been released. Two concurrent callers on the same mlx5_termtbl_handle race: one decrements ref_count to zero, removes the hash entry, and calls kfree(tt) while the other has already dropped the mutex and is about to evaluate if (!tt->ref_count), producing a use-after-free. Fix this by capturing the result of the decrement into a stack-local last variable before dropping the mutex. The cleanup decision is now made entirely under termtbl_mutex, and tt is not touched after kfree.