packet: fix race condition in packet_set_ring