netdev_run_todo() waits for outstanding RCU callbacks before flushing routes. However, rt_flush_dev() and rt6_uncached_list_flush_dev() can release the last reference held by a dst to an unregistering net_device. A reader can load the old device from dst->dev under RCU before dst_dev_put() replaces it with blackhole_netdev. A route release from an RCU callback can then drop the last reference while that newer reader is still active. The earlier rcu_barrier() does not wait for such a read-side critical section, so netdev_run_todo() can proceed to free the device underneath the reader. Wait for pre-existing networking RCU read-side critical sections after both route flushes and before freeing the devices. Ido Schimmel identified this missing grace period during review. The lifetime was validated by source inspection; this specific window has not been triggered independently at runtime. Fixes: 4a6ce2b6f2ec ("net: introduce a new function dst_dev_put()") Cc: stable@vger.kernel.org Suggested-by: Ido Schimmel Link: https://lore.kernel.org/netdev/20261125190113.GA421469@shredder/ Signed-off-by: Zhou Qiuyue --- net/core/dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/core/dev.c b/net/core/dev.c index cd0796a1d..2a9d9a06c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -12039,6 +12039,7 @@ void netdev_run_todo(void) if (!list_empty(&list)) { rt_flush_dev(NULL); rt6_uncached_list_flush_dev(NULL); + synchronize_net(); } cnt = 0; -- 2.56.1.windows.1