summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-09-30 18:21:09 +0200
committerAnton Arapov <anton@redhat.com>2012-10-29 11:50:17 +0100
commitbfc80eccab6ad4724c355ba9b1990e76339ce866 (patch)
treeec3f0612206798f132a9f9d845150135c982e342
parent2993045f4425ab3b42021c93bfcea9aae1367153 (diff)
downloadkernel-uprobes-bfc80eccab6ad4724c355ba9b1990e76339ce866.zip
kernel-uprobes-bfc80eccab6ad4724c355ba9b1990e76339ce866.tar.gz
kernel-uprobes-bfc80eccab6ad4724c355ba9b1990e76339ce866.tar.xz
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>
-rw-r--r--kernel/events/uprobes.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 6136854..588a557 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 *
mutex_lock(uprobes_hash(inode));
uprobe = alloc_uprobe(inode, offset);
- if (uprobe && !consumer_add(uprobe, uc)) {
+ if (!uprobe) {
+ ret = -ENOMEM;
+ } else if (!consumer_add(uprobe, uc)) {
ret = __uprobe_register(uprobe);
if (ret) {
uprobe->consumers = NULL;