Re: [PATCH 2/9] drm/gem: WARN if drm_gem_get_pages is called on a private obj

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 11.05.20 um 11:35 schrieb Daniel Vetter:
> No real functional change, since this just converts an annoying Oops
> into a more harmless WARNING backtrace. It's still a driver bug.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>

Acked-by: Thomas Zimmermann <tzimmermann@xxxxxxx>

> ---
>  drivers/gpu/drm/drm_gem.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 7bf628e13023..63bfd97e69d8 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -548,6 +548,10 @@ static void drm_gem_check_release_pagevec(struct pagevec *pvec)
>   * set during initialization. If you have special zone constraints, set them
>   * after drm_gem_object_init() via mapping_set_gfp_mask(). shmem-core takes care
>   * to keep pages in the required zone during swap-in.
> + *
> + * This function is only valid on objects initialized with
> + * drm_gem_object_init(), but not for those initialized with
> + * drm_gem_private_object_init() only.
>   */
>  struct page **drm_gem_get_pages(struct drm_gem_object *obj)
>  {
> @@ -556,6 +560,10 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
>  	struct pagevec pvec;
>  	int i, npages;
>  
> +
> +	if (WARN_ON(!obj->filp))
> +		return ERR_PTR(-EINVAL);
> +
>  	/* This is the shared memory object that backs the GEM resource */
>  	mapping = obj->filp->f_mapping;
>  
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux