lkml.org 
[lkml]   [2008]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][BUGFIX] kprobes: fix error checking of batch registration
Fix error checking routine to catch an error which occurs in
first __register_*porbe().

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>
---
I found this bug when fixing batch-registration test program.
This patch can be apply to both of 2.6.26-rc2-mm1 and 2.6.26-rc5.

kernel/kprobes.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

Index: 2.6.26-rc2-mm1/kernel/kprobes.c
===================================================================
--- 2.6.26-rc2-mm1.orig/kernel/kprobes.c
+++ 2.6.26-rc2-mm1/kernel/kprobes.c
@@ -699,8 +699,9 @@ static int __register_kprobes(struct kpr
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 jpr
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
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;
}
}
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com




\
 
 \ /
  Last update: 2008-06-11 00:59    [W:0.029 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site