diff mbox series

[2/4] Klock work Fix for NULL dereferencing in i915_gem_mman.c

Message ID 20210628143829.22995-3-krishnaiah.bommu@intel.com (mailing list archive)
State New, archived
Headers show
Series The Following Patches are to Fix the Critical KclockWork Errors in i915_gem and gt | expand

Commit Message

Bommu Krishnaiah June 28, 2021, 2:38 p.m. UTC
Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ramalingam C June 29, 2021, 9:23 a.m. UTC | #1
On 2021-06-28 at 20:08:27 +0530, Bommu Krishnaiah wrote:
> Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
> Cc: Abdiel Janulgue <abdiel.janulgue@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

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);
+
 	switch (mmo->mmap_type) {
 	case I915_MMAP_TYPE_WC:
 		vma->vm_page_prot =