Re: [PATCH vhost] virtio_ring: add BUG_ON() when vq is set to premapped mode and vq is not empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 19 Oct 2023 15:09:58 +0800, Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> wrote:
> Add BUG_ON check to make sure virtqueue_set_dma_premapped() is not
> misused. This function must be called immediately after creating the vq,
> or after vq reset, and before adding any buffers to it.
>
> Signed-off-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>

Hi Michael,

Is this in your list?

Thanks

> ---
>  drivers/virtio/virtio_ring.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> index 51d8f3299c10..3a3232272067 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -2793,10 +2793,7 @@ int virtqueue_set_dma_premapped(struct virtqueue *_vq)
>
>  	num = vq->packed_ring ? vq->packed.vring.num : vq->split.vring.num;
>
> -	if (num != vq->vq.num_free) {
> -		END_USE(vq);
> -		return -EINVAL;
> -	}
> +	BUG_ON(num != vq->vq.num_free);
>
>  	if (!vq->use_dma_api) {
>  		END_USE(vq);
> --
> 2.32.0.3.g01195cf9f
>




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux