From patchwork Wed Jun 21 21:19:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Kim, Dongwon" X-Patchwork-Id: 13287972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE5FCEB64D7 for ; Wed, 21 Jun 2023 21:40:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC5YE-0000QB-2w; Wed, 21 Jun 2023 17:39:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC5YA-0000Pf-Qp for qemu-devel@nongnu.org; Wed, 21 Jun 2023 17:39:39 -0400 Received: from mga11.intel.com ([192.55.52.93]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC5Y9-00065j-0D for qemu-devel@nongnu.org; Wed, 21 Jun 2023 17:39:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687383577; x=1718919577; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=p9BLet2xnL8h3a+xaxicCdxCNPe/jFBenIJbP6jnUR4=; b=mbXYH4LheL/gIFke0ML6c+x8KRJTxbzcAgx91TkThsOXZ0SeJeG7PotX MCe+TIZ83Vyq0y0iMxkFAIb4lmmZMRtpUmr0shkQDVmXEmy27jJ5RG4yY VR30AHMZ1bbx9nRRicMpI2Ima25SwFAA+F3XjH8IjL2sNAMZXR5+DFmRi 79xmFoOTIQK0fhaN/vLh4GJLECP/7E/nedh+L6fVpjhkFiZLiWH3ETW+f aNh5KXeT41wwj1jfNEgaELbdac4fMyKZiaieekyN3A/w8sJhPDlgTlQjc To4bX+1w27tQsPUerpM/vcIyDm8USQUU3jTKAWO9LXVyzfaKcnIqd1Gd5 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="357808665" X-IronPort-AV: E=Sophos;i="6.00,261,1681196400"; d="scan'208";a="357808665" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 14:39:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="784665841" X-IronPort-AV: E=Sophos;i="6.00,261,1681196400"; d="scan'208";a="784665841" Received: from dongwonk-z390-aorus-ultra-intel-gfx.fm.intel.com ([10.105.129.122]) by fmsmga004.fm.intel.com with ESMTP; 21 Jun 2023 14:39:04 -0700 From: Dongwon Kim To: qemu-devel@nongnu.org Cc: Dongwon Kim , Gerd Hoffmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Vivek Kasireddy Subject: [PATCH] virtio-gpu: OUT_OF_MEMORY if failing to create udmabuf Date: Wed, 21 Jun 2023 14:19:31 -0700 Message-Id: <20230621211931.29448-1-dongwon.kim@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Received-SPF: pass client-ip=192.55.52.93; envelope-from=dongwon.kim@intel.com; helo=mga11.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Respond with VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY if it fails to create an udmabuf for the blob resource. Cc: Gerd Hoffmann Cc: Marc-André Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim Reviewed-by: Marc-André Lureau --- 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; } } - data = res->blob; } else { data = (uint8_t *)pixman_image_get_data(res->image);