diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-09-30 12:21:09 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2012-10-07 15:19:41 -0400 |
commit | a5f658b71bc622b731961ea3addcf146ed3c599f (patch) | |
tree | 52ebe6fb29ef955cee71ded01154d89d77577410 /kernel | |
parent | b64b9c937a533f0bfbfc9f6ac93d3c3e2f97ab02 (diff) |
uprobes: Don't return success if alloc_uprobe() fails
If alloc_uprobe() fails uprobe_register() should return ENOMEM, not 0.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/uprobes.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 6136854da6c6..588a5575d64c 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -813,7 +813,9 @@ int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer * | |||
813 | mutex_lock(uprobes_hash(inode)); | 813 | mutex_lock(uprobes_hash(inode)); |
814 | uprobe = alloc_uprobe(inode, offset); | 814 | uprobe = alloc_uprobe(inode, offset); |
815 | 815 | ||
816 | if (uprobe && !consumer_add(uprobe, uc)) { | 816 | if (!uprobe) { |
817 | ret = -ENOMEM; | ||
818 | } else if (!consumer_add(uprobe, uc)) { | ||
817 | ret = __uprobe_register(uprobe); | 819 | ret = __uprobe_register(uprobe); |
818 | if (ret) { | 820 | if (ret) { |
819 | uprobe->consumers = NULL; | 821 | uprobe->consumers = NULL; |