diff options
-rw-r--r-- | kernel/kprobes.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 1e0250cb948..d4998f81e22 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -699,8 +699,9 @@ static int __register_kprobes(struct kprobe **kps, int num, | |||
699 | return -EINVAL; | 699 | return -EINVAL; |
700 | for (i = 0; i < num; i++) { | 700 | for (i = 0; i < num; i++) { |
701 | ret = __register_kprobe(kps[i], called_from); | 701 | ret = __register_kprobe(kps[i], called_from); |
702 | if (ret < 0 && i > 0) { | 702 | if (ret < 0) { |
703 | unregister_kprobes(kps, i); | 703 | if (i > 0) |
704 | unregister_kprobes(kps, i); | ||
704 | break; | 705 | break; |
705 | } | 706 | } |
706 | } | 707 | } |
@@ -776,8 +777,9 @@ static int __register_jprobes(struct jprobe **jps, int num, | |||
776 | jp->kp.break_handler = longjmp_break_handler; | 777 | jp->kp.break_handler = longjmp_break_handler; |
777 | ret = __register_kprobe(&jp->kp, called_from); | 778 | ret = __register_kprobe(&jp->kp, called_from); |
778 | } | 779 | } |
779 | if (ret < 0 && i > 0) { | 780 | if (ret < 0) { |
780 | unregister_jprobes(jps, i); | 781 | if (i > 0) |
782 | unregister_jprobes(jps, i); | ||
781 | break; | 783 | break; |
782 | } | 784 | } |
783 | } | 785 | } |
@@ -920,8 +922,9 @@ static int __register_kretprobes(struct kretprobe **rps, int num, | |||
920 | return -EINVAL; | 922 | return -EINVAL; |
921 | for (i = 0; i < num; i++) { | 923 | for (i = 0; i < num; i++) { |
922 | ret = __register_kretprobe(rps[i], called_from); | 924 | ret = __register_kretprobe(rps[i], called_from); |
923 | if (ret < 0 && i > 0) { | 925 | if (ret < 0) { |
924 | unregister_kretprobes(rps, i); | 926 | if (i > 0) |
927 | unregister_kretprobes(rps, i); | ||
925 | break; | 928 | break; |
926 | } | 929 | } |
927 | } | 930 | } |