Skip to content

Commit

Permalink
kprobes: fix error checking of batch registration
Browse files Browse the repository at this point in the history
Fix error checking routine to catch an error which occurs in first
__register_*probe().

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
Cc: Jim Keniston <[email protected]>
Cc: David Miller <[email protected]>
Cc: Anil S Keshavamurthy <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Masami Hiramatsu authored and torvalds committed Jun 13, 2008
1 parent 24aac48 commit 67dddaa
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,9 @@ static int __register_kprobes(struct kprobe **kps, int num,
return -EINVAL;
for (i = 0; i < num; i++) {
ret = __register_kprobe(kps[i], called_from);
if (ret < 0 && i > 0) {
unregister_kprobes(kps, i);
if (ret < 0) {
if (i > 0)
unregister_kprobes(kps, i);
break;
}
}
Expand Down Expand Up @@ -776,8 +777,9 @@ static int __register_jprobes(struct jprobe **jps, int num,
jp->kp.break_handler = longjmp_break_handler;
ret = __register_kprobe(&jp->kp, called_from);
}
if (ret < 0 && i > 0) {
unregister_jprobes(jps, i);
if (ret < 0) {
if (i > 0)
unregister_jprobes(jps, i);
break;
}
}
Expand Down Expand Up @@ -920,8 +922,9 @@ static int __register_kretprobes(struct kretprobe **rps, int num,
return -EINVAL;
for (i = 0; i < num; i++) {
ret = __register_kretprobe(rps[i], called_from);
if (ret < 0 && i > 0) {
unregister_kretprobes(rps, i);
if (ret < 0) {
if (i > 0)
unregister_kretprobes(rps, i);
break;
}
}
Expand Down

0 comments on commit 67dddaa

Please sign in to comment.