[Mesa-dev] [PATCH 2/2] vulkan/wsi/x11: don't crash on null visual

2016-12-22 Thread Arda Coskunses
When application window closed unexpectedly due to
lost window visualtypes getting invlaid parameters
which is causing a crash. Necessary check is added
to prevent the crash.
---
 src/vulkan/wsi/wsi_common_x11.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index afb7809..8afff8b 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -354,6 +354,9 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
xcb_visualtype_t *visual =
   get_visualtype_for_window(conn, window, &visual_depth);
 
+   if (!visual)
+  return VK_ERROR_OUT_OF_HOST_MEMORY;
+
geom = xcb_get_geometry_reply(conn, geom_cookie, &err);
if (geom) {
   VkExtent2D extent = { geom->width, geom->height };
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] vulkan/wsi: don't crash on null swapchain

2016-12-22 Thread Arda Coskunses
When application window closed unexpectedly
anv_GetSwapchainImagesKHR function getting
called with invlid parameters which cause a
crash. Necessary Null check added
---
 src/intel/vulkan/anv_wsi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 669eacc..1e05daf 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -320,6 +320,9 @@ VkResult anv_GetSwapchainImagesKHR(
 {
ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
 
+   if(!swapchain)
+  return VK_INCOMPLETE;
+
return swapchain->get_images(swapchain, pSwapchainImageCount,
 pSwapchainImages);
 }
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] vulkan/wsi: don't crash on null swapchain

2016-12-22 Thread Arda Coskunses
OK agree, spec is clear on this matter.

On Thu, Dec 22, 2016 at 1:48 PM, Jason Ekstrand 
wrote:

> Nak.
>
> From the Vulkan spec 1.0.37, valid usage for vkGetSwapchainimagesKHR:
>
>- *swapchain* must be a valid VkSwapchainKHR handle
>
> We don't silently handle invalid usage.
>
> On Thu, Dec 22, 2016 at 9:30 AM, Arda Coskunses 
> wrote:
>
>> When application window closed unexpectedly
>> anv_GetSwapchainImagesKHR function getting
>> called with invlid parameters which cause a
>> crash. Necessary Null check added
>> ---
>>  src/intel/vulkan/anv_wsi.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
>> index 669eacc..1e05daf 100644
>> --- a/src/intel/vulkan/anv_wsi.c
>> +++ b/src/intel/vulkan/anv_wsi.c
>> @@ -320,6 +320,9 @@ VkResult anv_GetSwapchainImagesKHR(
>>  {
>> ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
>>
>> +   if(!swapchain)
>> +  return VK_INCOMPLETE;
>> +
>> return swapchain->get_images(swapchain, pSwapchainImageCount,
>>  pSwapchainImages);
>>  }
>> --
>> 2.7.4
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] vulkan/wsi/x11: don't crash on null visual

2016-12-22 Thread Arda Coskunses
When application window closed unexpectedly due to
lost window visualtypes getting invlaid parameters
which is causing a crash. Necessary check is added
to prevent the crash.
---
 src/vulkan/wsi/wsi_common_x11.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index afb7809..08b0479 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -354,6 +354,9 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
xcb_visualtype_t *visual =
   get_visualtype_for_window(conn, window, &visual_depth);
 
+   if (!visual)
+  return VK_ERROR_SURFACE_LOST_KHR;
+
geom = xcb_get_geometry_reply(conn, geom_cookie, &err);
if (geom) {
   VkExtent2D extent = { geom->width, geom->height };
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] vulkan/wsi/x11: don't crash on null wsi x11 connection

2016-12-22 Thread Arda Coskunses
Without this check driver crash when application window
closed unexpectedly.
Acked-by: Edward O'Callaghan 
---
 src/vulkan/wsi/wsi_common_x11.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 037aa50..345740e 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -261,6 +261,10 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
struct wsi_x11_connection *wsi_conn =
   wsi_x11_get_connection(wsi_device, alloc, connection);
 
+   if (!wsi_conn) {
+  return false;
+   }
+
if (!wsi_conn->has_dri3) {
   fprintf(stderr, "vulkan: No DRI3 support\n");
   return false;
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] vulkan/wsi/x11: don't crash on null wsi x11 connection

2016-12-19 Thread Arda Coskunses
Without this check driver crash when application window
closed unexpectedly.
---
 src/vulkan/wsi/wsi_common_x11.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 25ba0c1..afb7809 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -261,6 +261,11 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
struct wsi_x11_connection *wsi_conn =
   wsi_x11_get_connection(wsi_device, alloc, connection);
 
+   if (!wsi_conn) {
+  fprintf(stderr, "vulkan: wsi connection lost\n");
+  return false;
+   }
+
if (!wsi_conn->has_dri3) {
   fprintf(stderr, "vulkan: No DRI3 support\n");
   return false;
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev