Commit 67dddaad5d8b8c5ee5b96a7e2f6cb0faad703865

Authored by Masami Hiramatsu
Committed by Linus Torvalds
1 parent 24aac480e7

kprobes: fix error checking of batch registration

Fix error checking routine to catch an error which occurs in first
__register_*probe().

Signed-off-by: Masami 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 9 additions and 6 deletions Side-by-side Diff

... ... @@ -699,8 +699,9 @@
699 699 return -EINVAL;
700 700 for (i = 0; i < num; i++) {
701 701 ret = __register_kprobe(kps[i], called_from);
702   - if (ret < 0 && i > 0) {
703   - unregister_kprobes(kps, i);
  702 + if (ret < 0) {
  703 + if (i > 0)
  704 + unregister_kprobes(kps, i);
704 705 break;
705 706 }
706 707 }
... ... @@ -776,8 +777,9 @@
776 777 jp->kp.break_handler = longjmp_break_handler;
777 778 ret = __register_kprobe(&jp->kp, called_from);
778 779 }
779   - if (ret < 0 && i > 0) {
780   - unregister_jprobes(jps, i);
  780 + if (ret < 0) {
  781 + if (i > 0)
  782 + unregister_jprobes(jps, i);
781 783 break;
782 784 }
783 785 }
... ... @@ -920,8 +922,9 @@
920 922 return -EINVAL;
921 923 for (i = 0; i < num; i++) {
922 924 ret = __register_kretprobe(rps[i], called_from);
923   - if (ret < 0 && i > 0) {
924   - unregister_kretprobes(rps, i);
  925 + if (ret < 0) {
  926 + if (i > 0)
  927 + unregister_kretprobes(rps, i);
925 928 break;
926 929 }
927 930 }