[PATCH 2/2] drm/virtio: make sure virtio_gpu_cleanup_object(..) only happens on shmem objects

Gerd Hoffmann kraxel at redhat.com
Tue Mar 3 10:01:21 UTC 2020


> This function won't be useable for hostmem objects.

> @@ -526,7 +526,8 @@ static void virtio_gpu_cmd_unref_cb(struct virtio_gpu_device *vgdev,
>  	bo = vbuf->resp_cb_data;
>  	vbuf->resp_cb_data = NULL;
>  
> -	virtio_gpu_cleanup_object(bo);
> +	if (bo && virtio_gpu_is_shmem(bo))
> +		virtio_gpu_cleanup_object(bo);

Its not that simple, the virtio_gpu_resource_id_put() call in
virtio_gpu_cleanup_object() is needed for all objects.  We also
must free all objects.

I'd suggest to move the virtio_gpu_is_shmem() check to
virtio_gpu_cleanup_object().

cheers,
  Gerd



More information about the dri-devel mailing list