[PATCH] drm/xe/xe_sync: initialise ufence.signalled

Matthew Brost matthew.brost at intel.com
Sat Oct 12 02:08:55 UTC 2024


On Fri, Oct 11, 2024 at 02:36:34PM +0100, Matthew Auld wrote:
> We can incorrectly think that the fence has signalled, if we get a
> non-zero value here from the kmalloc, which is quite plausible. Just use
> kzalloc to prevent stuff like this.
> 
> Fixes: 977e5b82e090 ("drm/xe: Expose user fence from xe_sync_entry")
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> Cc: Nirmoy Das <nirmoy.das at intel.com>
> Cc: <stable at vger.kernel.org> # v6.10+
> ---
>  drivers/gpu/drm/xe/xe_sync.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
> index bb3c2a830362..c6cf227ead40 100644
> --- a/drivers/gpu/drm/xe/xe_sync.c
> +++ b/drivers/gpu/drm/xe/xe_sync.c
> @@ -58,7 +58,7 @@ static struct xe_user_fence *user_fence_create(struct xe_device *xe, u64 addr,
>  	if (!access_ok(ptr, sizeof(*ptr)))
>  		return ERR_PTR(-EFAULT);
>  
> -	ufence = kmalloc(sizeof(*ufence), GFP_KERNEL);
> +	ufence = kzalloc(sizeof(*ufence), GFP_KERNEL);
>  	if (!ufence)
>  		return ERR_PTR(-ENOMEM);
>  
> -- 
> 2.46.2
> 


More information about the Intel-xe mailing list