> Bounding get_rx_bufs() (e.g. capping its quota against vq->num, or
> checking in-flight descriptors more broadly) is certainly worth
> looking at separately, while keeping the mask in
> vhost_add_used_n_in_order() keeps the dirty-logging cursor consistent
> with the publishing loop from commit e244725e86be.

Hmm, I'd actually go the other way round. Isn't the cap the real fix
here? The mask feels more like hardening to me.

Though the cap changes things for a packet that can't fit even a full
ring. If I read it right, today get_rx_bufs() runs out of descriptors,
rewinds and waits for a refill that never comes, since the guest has
nothing left to post, so the queue just sits there. With the cap it
hits the quota instead and the packet goes down the overrun path and
gets dropped. Probably better, but it's a behavior change, so it'd
need some care not to regress anything... a bit tricky I guess.


Reply via email to