Skip to content

Commit

Permalink
[PATCH] kprobes: NULL out non-relevant fields in struct kretprobe
Browse files Browse the repository at this point in the history
In cases where a struct kretprobe's *_handler fields are non-NULL, it is
possible to cause a system crash, due to the possibility of calls ending up
in zombie functions.  Documentation clearly states that unused *_handlers
should be set to NULL, but kprobe users sometimes fail to do so.

Fix it by setting the non-relevant fields of the struct kretprobe to NULL.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Acked-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Ananth N Mavinakayanahalli authored and Linus Torvalds committed Apr 20, 2006
1 parent 5a7b46b commit 7522a84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
int i;

rp->kp.pre_handler = pre_handler_kretprobe;
rp->kp.post_handler = NULL;
rp->kp.fault_handler = NULL;
rp->kp.break_handler = NULL;

/* Pre-allocate memory for max kretprobe instances */
if (rp->maxactive <= 0) {
Expand Down

0 comments on commit 7522a84

Please sign in to comment.