Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350090
b: refs/heads/master
c: c8a8253
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov committed Feb 8, 2013
1 parent e9d0283 commit 824c4e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 74e59dfc6b19e3472a7c16ad57bc831e6e647895
refs/heads/master: c8a82538001e1a68f4a319d5a75de90d1f284731
32 changes: 13 additions & 19 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,22 +1041,14 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
/* Slot allocation for XOL */
static int xol_add_vma(struct xol_area *area)
{
struct mm_struct *mm;
int ret;

area->page = alloc_page(GFP_HIGHUSER);
if (!area->page)
return -ENOMEM;

ret = -EALREADY;
mm = current->mm;
struct mm_struct *mm = current->mm;
int ret = -EALREADY;

down_write(&mm->mmap_sem);
if (mm->uprobes_state.xol_area)
goto fail;

ret = -ENOMEM;

/* Try to map as high as possible, this is only a hint. */
area->vaddr = get_unmapped_area(NULL, TASK_SIZE - PAGE_SIZE, PAGE_SIZE, 0, 0);
if (area->vaddr & ~PAGE_MASK) {
Expand All @@ -1072,11 +1064,8 @@ static int xol_add_vma(struct xol_area *area)
smp_wmb(); /* pairs with get_xol_area() */
mm->uprobes_state.xol_area = area;
ret = 0;

fail:
fail:
up_write(&mm->mmap_sem);
if (ret)
__free_page(area->page);

return ret;
}
Expand Down Expand Up @@ -1104,21 +1093,26 @@ static struct xol_area *xol_alloc_area(void)

area = kzalloc(sizeof(*area), GFP_KERNEL);
if (unlikely(!area))
return NULL;
goto out;

area->bitmap = kzalloc(BITS_TO_LONGS(UINSNS_PER_PAGE) * sizeof(long), GFP_KERNEL);

if (!area->bitmap)
goto fail;
goto free_area;

area->page = alloc_page(GFP_HIGHUSER);
if (!area->page)
goto free_bitmap;

init_waitqueue_head(&area->wq);
if (!xol_add_vma(area))
return area;

fail:
__free_page(area->page);
free_bitmap:
kfree(area->bitmap);
free_area:
kfree(area);

out:
return get_xol_area(current->mm);
}

Expand Down

0 comments on commit 824c4e0

Please sign in to comment.