Skip to content

Commit

Permalink
uprobes: Don't return success if alloc_uprobe() fails
Browse files Browse the repository at this point in the history
If alloc_uprobe() fails uprobe_register() should return ENOMEM, not 0.

Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Srikar Dronamraju <[email protected]>
  • Loading branch information
oleg-nesterov committed Oct 7, 2012
1 parent b64b9c9 commit a5f658b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a5f658b

Please sign in to comment.