[Mesa-dev] [Mesa-stable] [PATCH] st/clover: Don't segfault on clCreateBuffer with null context

Francisco Jerez currojerez at riseup.net
Thu Apr 3 16:54:39 PDT 2014


Aaron Watry <awatry at gmail.com> writes:

> This should fix a segfault in the case that you're not using ocl-icd.
>
> If you're using ocl-icd, make sure your version is new enough or you'll get
> the segfault before you even get to clover.
>
> The null de-ref seems to have been introduced in 10.1, but earlier versions
> have have also been affected in other ways.
>

NAK.  The obj() function already checks if the pointer is NULL.  Not
sure how you're getting a segfault.

> CC: "10.1" <mesa-stable at lists.freedesktop.org>
>
> Signed-off-by: Aaron Watry <awatry at gmail.com>
> ---
>  src/gallium/state_trackers/clover/api/memory.cpp | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
> index 7ed2191..dad5ad3 100644
> --- a/src/gallium/state_trackers/clover/api/memory.cpp
> +++ b/src/gallium/state_trackers/clover/api/memory.cpp
> @@ -32,6 +32,9 @@ clCreateBuffer(cl_context d_ctx, cl_mem_flags flags, size_t size,
>                 void *host_ptr, cl_int *r_errcode) try {
>     auto &ctx = obj(d_ctx);
>  
> +   if (d_ctx == NULL)
> +	   throw error(CL_INVALID_CONTEXT);
> +
>     if (bool(host_ptr) != bool(flags & (CL_MEM_USE_HOST_PTR |
>                                         CL_MEM_COPY_HOST_PTR)))
>        throw error(CL_INVALID_HOST_PTR);
> -- 
> 1.8.3.2
>
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140404/94589dcd/attachment.sig>


More information about the mesa-dev mailing list