Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334768
b: refs/heads/master
c: 4710f05
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov committed Oct 7, 2012
1 parent e279110 commit 44167ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb9a19fe4aa51afa34786bd383e6614fa0083d58
refs/heads/master: 4710f05fd146d4739e57a8832a3abc5bd3bf0997
8 changes: 8 additions & 0 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ struct uprobe {
struct rb_node rb_node; /* node in the rb tree */
atomic_t ref;
struct rw_semaphore consumer_rwsem;
struct mutex copy_mutex; /* TODO: kill me and UPROBE_COPY_INSN */
struct list_head pending_list;
struct uprobe_consumer *consumers;
struct inode *inode; /* Also hold a ref to inode */
Expand Down Expand Up @@ -444,6 +445,7 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
uprobe->inode = igrab(inode);
uprobe->offset = offset;
init_rwsem(&uprobe->consumer_rwsem);
mutex_init(&uprobe->copy_mutex);

/* add to uprobes_tree, sorted on inode:offset */
cur_uprobe = insert_uprobe(uprobe);
Expand Down Expand Up @@ -578,6 +580,10 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
if (uprobe->flags & UPROBE_COPY_INSN)
return ret;

mutex_lock(&uprobe->copy_mutex);
if (uprobe->flags & UPROBE_COPY_INSN)
goto out;

ret = copy_insn(uprobe, file);
if (ret)
goto out;
Expand All @@ -598,6 +604,8 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
uprobe->flags |= UPROBE_COPY_INSN;

out:
mutex_unlock(&uprobe->copy_mutex);

return ret;
}

Expand Down

0 comments on commit 44167ff

Please sign in to comment.