summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/fsl_qbman/fsl_usdpaa.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c
index 0e6adca..dbbc80f 100644
--- a/drivers/staging/fsl_qbman/fsl_usdpaa.c
+++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c
@@ -1009,7 +1009,8 @@ static long ioctl_dma_unmap(struct ctx *ctx, void __user *arg)
{
struct mem_mapping *map;
struct vm_area_struct *vma;
- int ret;
+ int ret, i;
+ struct mem_fragment *current_frag;
down_write(&current->mm->mmap_sem);
vma = find_vma(current->mm, (unsigned long)arg);
@@ -1031,6 +1032,13 @@ static long ioctl_dma_unmap(struct ctx *ctx, void __user *arg)
}
map = NULL;
map_match:
+ current_frag = map->root_frag;
+ for (i = 0; i < map->frag_count; i++) {
+ DPA_ASSERT(current_frag->refs > 0);
+ --current_frag->refs;
+ current_frag = list_entry(current_frag->list.prev,
+ struct mem_fragment, list);
+ }
list_del(&map->list);
compress_frags();
spin_unlock(&mem_lock);