Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] kprobes: NULL out non-relevant fields in struct kretprobe

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>

authored by

Ananth N Mavinakayanahalli and committed by
Linus Torvalds
7522a842 5a7b46b3

+3
+3
kernel/kprobes.c
··· 585 585 int i; 586 586 587 587 rp->kp.pre_handler = pre_handler_kretprobe; 588 + rp->kp.post_handler = NULL; 589 + rp->kp.fault_handler = NULL; 590 + rp->kp.break_handler = NULL; 588 591 589 592 /* Pre-allocate memory for max kretprobe instances */ 590 593 if (rp->maxactive <= 0) {