Skip to content

Commit

Permalink
Fix memory map issue. Author: hcar. Source: https://aur.archlinux.org…
Browse files Browse the repository at this point in the history
  • Loading branch information
isabekov committed May 18, 2022
1 parent 2fc7b1b commit 5ef4526
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/fl2000_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ int fl2000_surface_pin_down(
case SURFACE_TYPE_VIRTUAL_FRAGMENTED_VOLATILE:
case SURFACE_TYPE_VIRTUAL_FRAGMENTED_PERSISTENT:
while (surface->pages_pinned != nr_pages) {
down_read(&current->mm->mmap_sem);
mmap_read_lock(current->mm);
pages_pinned = fl2000_get_user_pages(
surface->user_buffer,
nr_pages,
pages,
NULL);
up_read(&current->mm->mmap_sem);
mmap_read_unlock(current->mm);
if (pages_pinned <= 0) {
dbg_msg(TRACE_LEVEL_ERROR, DBG_PNP,
"get_user_pages fails with %d\n", pages_pinned);
Expand All @@ -126,7 +126,7 @@ int fl2000_surface_pin_down(
break;

case SURFACE_TYPE_VIRTUAL_CONTIGUOUS:
down_read(&current->mm->mmap_sem);
mmap_read_lock(current->mm);
/*
* work-around the user memory which is mapped from driver,
* but with VM_IO, VM_PFNMAP flags. This API assumes the mmaped user addr
Expand All @@ -141,7 +141,7 @@ int fl2000_surface_pin_down(
pages,
NULL);
vma->vm_flags = old_flags;
up_read(&current->mm->mmap_sem);
mmap_read_unlock(current->mm);
if (pages_pinned <= 0) {
dbg_msg(TRACE_LEVEL_ERROR, DBG_PNP,
"get_user_pages fails with %d\n", pages_pinned);
Expand Down Expand Up @@ -228,8 +228,7 @@ int fl2000_surface_map(
surface->mapped_buffer = vm_map_ram(
surface->pages,
surface->nr_pages,
-1,
PAGE_KERNEL);
-1);
if (surface->mapped_buffer == NULL) {
dbg_msg(TRACE_LEVEL_ERROR, DBG_PNP, "vm_map_ram failed?");
ret_val = -ENOMEM;
Expand Down

0 comments on commit 5ef4526

Please sign in to comment.