All of lore.kernel.org
 help / color / mirror / Atom feed
* [Q] vhost: returning misconfigured buffers
@ 2020-05-14 12:55 Guennadi Liakhovetski
  0 siblings, 0 replies; only message in thread
From: Guennadi Liakhovetski @ 2020-05-14 12:55 UTC (permalink / raw)
  To: virtualization

Hi,

Many vhost drivers follow a common process to obtain and verify 
received buffers:

head = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov), &out, &in,...);
if (head < 0) {
	return ret;
}
if (head == vq->num) {
	/* no buffer */
	return 0; /* or -EAGAIN or whatever */
}
if (out != EXPECTED_OUT_BUFFERS || in != EXPECTED_IN_BUFFERS) {
	return -EINVAL;
}
/* all good, use buffers */
vhost_add_used(...);

Which seems to me to be leaking buffers in the last error case - 
if the buffer configuration was unexpected. Shouldn't drivers in 
such cases also use vhost_add_used() to return the buffer?

Thanks
Guennadi

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-14 12:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 12:55 [Q] vhost: returning misconfigured buffers Guennadi Liakhovetski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.