Michel Dänzer wrote:
> From: Michel Dänzer <daen...@vmware.com>
>
> Make sure bo->vm_node is valid, to prevent crashes in the fault handler, and
> adjust vma->vm_pgoff according to it, so userspace attempts to access /dev/fb*
> mappings don't always result in SIGBUS.
>
> Signed-off-by: Michel Dänzer <daen...@vmware.com>
> ---
>  drivers/gpu/drm/ttm/ttm_bo_vm.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index 27b146c..57d0c94 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -282,7 +282,13 @@ int ttm_fbdev_mmap(struct vm_area_struct *vma, struct 
> ttm_buffer_object *bo)
>       if (vma->vm_pgoff != 0)
>               return -EACCES;
>  
> +     if (!bo->vm_node) {
> +             printk(KERN_ERR TTM_PFX "bo->vm_node == NULL\n");
> +             return -EACCES;
> +     }
>   

Michel,
Did you actually hit a bo with an invalid vm_node?
IIRC, if vm_node creation fails, the bo creation should also fail.

Otherwise it looks good.

/Thomas

> +
>       vma->vm_ops = &ttm_bo_vm_ops;
> +     vma->vm_pgoff = bo->vm_node->start;
>       vma->vm_private_data = ttm_bo_reference(bo);
>       vma->vm_flags |= VM_RESERVED | VM_IO | VM_MIXEDMAP | VM_DONTEXPAND;
>       return 0;
>   




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to