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:47:48 +0100
commit50529b8a0e1f7a560ffb5fe3672e3782d0c549c8 (patch)
tree3e32f41df2b8669484f0c6dd02f699056286e531
parent21d337e9688116ac3e416e181650127f89a75cb9 (diff)
downloadkernel-uprobes-50529b8a0e1f7a560ffb5fe3672e3782d0c549c8.zip
kernel-uprobes-50529b8a0e1f7a560ffb5fe3672e3782d0c549c8.tar.gz
kernel-uprobes-50529b8a0e1f7a560ffb5fe3672e3782d0c549c8.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;