CVE-2026-72322: ipv6: mcast: Fix potential UAF in MLD delayed work
In the Linux kernel, the following vulnerability has been resolved:
ipv6: mcast: Fix potential UAF in MLD delayed work
A race condition exists between device teardown and incoming MLD query processing, leading to a Use-After-Free in the MLD delayed work.
During device destruction, the primary reference to inet6dev is dropped, which can drop its refcount to 0. The actual freeing of inet6dev memory is deferred via RCU.
Concurrently, the packet receive path runs under RCU read lock and obtains the inet6dev pointer. Because the memory is RCU-protected, CPU-0 can safely dereference inet6dev even if its refcount has hit 0.
However, if CPU-0 calls igmp6eventquery() and schedules delayed work, it attempts to acquire a reference using in6devhold(). This increments the refcount from 0 to 1, triggering a "refcountt: addition on 0" warning. Since the inet6dev memory is still scheduled to be freed after the RCU grace period, the device is freed while the work is still scheduled. When the work runs, it accesses the freed memory, causing a kernel panic.
Fix this by using refcountincnotzero() (via a new helper in6devholdsafe()) to prevent acquiring a reference if the device is already being destroyed. If the refcount is 0, we do not schedule the work.