]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
kprobes: fix error checking of batch registration
authorMasami Hiramatsu <mhiramat@redhat.com>
Thu, 12 Jun 2008 22:21:35 +0000 (15:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Jun 2008 01:05:40 +0000 (18:05 -0700)
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>
kernel/kprobes.c

index 1e0250cb94860be6931efce5e37138fa488c18db..d4998f81e229efdc83d7135ecc61fa0cc70ecd91 100644 (file)
@@ -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;
                }
        }
@@ -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;
                }
        }
@@ -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;
                }
        }