Commit 67dddaad authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Linus Torvalds

kprobes: fix error checking of batch registration

Fix error checking routine to catch an error which occurs in first
__register_*probe().
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: David Miller <davem@davemloft.net>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 24aac480
...@@ -699,8 +699,9 @@ static int __register_kprobes(struct kprobe **kps, int num, ...@@ -699,8 +699,9 @@ static int __register_kprobes(struct kprobe **kps, int num,
return -EINVAL; return -EINVAL;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
ret = __register_kprobe(kps[i], called_from); ret = __register_kprobe(kps[i], called_from);
if (ret < 0 && i > 0) { if (ret < 0) {
unregister_kprobes(kps, i); if (i > 0)
unregister_kprobes(kps, i);
break; break;
} }
} }
...@@ -776,8 +777,9 @@ static int __register_jprobes(struct jprobe **jps, int num, ...@@ -776,8 +777,9 @@ static int __register_jprobes(struct jprobe **jps, int num,
jp->kp.break_handler = longjmp_break_handler; jp->kp.break_handler = longjmp_break_handler;
ret = __register_kprobe(&jp->kp, called_from); ret = __register_kprobe(&jp->kp, called_from);
} }
if (ret < 0 && i > 0) { if (ret < 0) {
unregister_jprobes(jps, i); if (i > 0)
unregister_jprobes(jps, i);
break; break;
} }
} }
...@@ -920,8 +922,9 @@ static int __register_kretprobes(struct kretprobe **rps, int num, ...@@ -920,8 +922,9 @@ static int __register_kretprobes(struct kretprobe **rps, int num,
return -EINVAL; return -EINVAL;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
ret = __register_kretprobe(rps[i], called_from); ret = __register_kretprobe(rps[i], called_from);
if (ret < 0 && i > 0) { if (ret < 0) {
unregister_kretprobes(rps, i); if (i > 0)
unregister_kretprobes(rps, i);
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment