Use list_for_each_entry_safe() when flushing queue.