diff mbox series

virtio-gpu: OUT_OF_MEMORY if failing to create udmabuf

Message ID 20230621211931.29448-1-dongwon.kim@intel.com (mailing list archive)
State New, archived
Headers show
Series virtio-gpu: OUT_OF_MEMORY if failing to create udmabuf | expand

Commit Message

Kim, Dongwon June 21, 2023, 9:19 p.m. UTC
Respond with VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY if it fails to create
an udmabuf for the blob resource.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
 hw/display/virtio-gpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Marc-André Lureau June 22, 2023, 1:24 p.m. UTC | #1
Hi

On Wed, Jun 21, 2023 at 11:40 PM Dongwon Kim <dongwon.kim@intel.com> wrote:

> Respond with VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY if it fails to create
> an udmabuf for the blob resource.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
> ---
>  hw/display/virtio-gpu.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 66cddd94d9..efe66ca7a3 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -635,9 +635,11 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g,
>              if (!virtio_gpu_update_dmabuf(g, scanout_id, res, fb, r)) {
>                  virtio_gpu_update_scanout(g, scanout_id, res, r);
>                  return;
> +            } else {
> +                *error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY;
> +                return;
>              }
>          }
> -
>

unrelated style change


>          data = res->blob;
>      } else {
>          data = (uint8_t *)pixman_image_get_data(res->image);
> --
> 2.34.1
>
>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
diff mbox series

Patch

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 66cddd94d9..efe66ca7a3 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -635,9 +635,11 @@  static void virtio_gpu_do_set_scanout(VirtIOGPU *g,
             if (!virtio_gpu_update_dmabuf(g, scanout_id, res, fb, r)) {
                 virtio_gpu_update_scanout(g, scanout_id, res, r);
                 return;
+            } else {
+                *error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY;
+                return;
             }
         }
-
         data = res->blob;
     } else {
         data = (uint8_t *)pixman_image_get_data(res->image);