В ядре Linux была устранена следующая уязвимость: ipv6: Исправление утечки dst для некэшированных маршрутов. ip6_route_output_flags(), ip6_rt_put_flags(), и ip6_dst_check() обнаруживают некэшированный маршрут list_empty(&rt->dst.rt_uncached), который заменил статическую проверку флага DST_NOCACHE в commit a4c2fd7f7891 («net: удалить флаг DST_NOCACHE»). Когда устройство незарегистрировано, rt6_uncached_list_flush_dev () отключает некэшированные маршруты, привязанные к устройству из rt6_uncached_list. Ранее они были перенесены в другой список с list_move() (__list_del_entry() + list_add()), и поскольку commit 98aa546af5e4 («inet: remove (struct uncached_list)->quarantine)»), маршруты просто не связаны с list_del_init().
Если list_del_init() работает одновременно, list_empty() вычисляется как true; ip6_route_output_flags() вызывает dst_hold_safe() неправильно, а ip6_rt_put_flags() пропускает ip6_rt_put(), протекая dst, и, таким образом, разработчик также связан через rt->from. Эта же гонка частично фиксируется коммитом 9a6f0c4d5796 («dst: fix races in rt6_uncached_list_del() and rt_del_uncached_list()»). Вместо этого проверим rt6->dst.rt_uncached_list.
Обратите внимание, что IPv4 не имеет такой же проблемы.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: ipv6: Fix dst leak for uncached routes. ip6_route_output_flags(), ip6_rt_put_flags(), and ip6_dst_check() detect an uncached route by list_empty(&rt->dst.rt_uncached), which replaced the static DST_NOCACHE flag check in commit a4c2fd7f7891 ("net: remove DST_NOCACHE flag"). When a device is unregistered, rt6_uncached_list_flush_dev() unlinks uncached routes tied to the device from rt6_uncached_list. Previously, they were moved to another list with list_move() (__list_del_entry() + list_add()), and since commit 98aa546af5e4 ("inet: remove (struct uncached_list)->quarantine"), the routes are just unlinked with list_del_init(). If list_del_init() runs concurrently, list_empty() evaluates to true; ip6_route_output_flags() calls dst_hold_safe() incorrectly and ip6_rt_put_flags() skips ip6_rt_put(), leaking dst, and thus dev tied via rt->from as well. The same race is partially fixed by commit 9a6f0c4d5796 ("dst: fix races in rt6_uncached_list_del() and rt_del_uncached_list()"). Let's check rt6->dst.rt_uncached_list instead. Note that IPv4 does not have the same issue.