[Intel-gfx] [PATCH 2/4] Klock work Fix for NULL dereferencing in i915_gem_mman.c

Ramalingam C ramalingam.c at intel.com
Tue Jun 29 09:23:18 UTC 2021


On 2021-06-28 at 20:08:27 +0530, Bommu Krishnaiah wrote:
> Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu at intel.com>
> Cc: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> index a90f796e85c03..cad33cd49ba95 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
> @@ -961,6 +961,8 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
>  
>  	vma->vm_private_data = mmo;
>  
> +	GEM_BUG_ON(!mmo);
> +
This also looks false positive to me. As mmo is dereferenced only when
the if (!node->driver_private && !obj->ops->mmap_ops)

 when node->driver_private is true but obj->ops->mmap_ops is not true
 then mmo will be NULL. Which is already captured as GEM_BUG_ON(obj && !obj->ops->mmap_ops);

 So we can ignore this too.

 Ram


>  	switch (mmo->mmap_type) {
>  	case I915_MMAP_TYPE_WC:
>  		vma->vm_page_prot =
> -- 
> 2.25.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list