Unable to resolve kernel panic in a custom Netfilter hook
I try to implement my first kernel module. I have just come to a problem which I'm unable to solve ...
I do "something" what raises a kernel panic. Relevant code is:
_filter_rule * placebo( void)
int rp( struct sk_buff ** skb)
_filter_rule * rule = NULL;
rule = placebo();
//(2) if( rule == NULL)
// rule = placebo();
it is the simpliest version of code which raises the kernel panic.
The rp is called from a netfilter prerouting hook. So as far as I know it should run in a SoftIrq context.
If I uncoment line with placeboCall++ (see (1)) the code raises kernel panic otherwise not. The placeboCall is module's global variable. Similary if I leave placeboCall++ in a comment and try to do a test on the returned value (see (2)). It raises kernel panic too. Both panics reports a problem in the rp function.
It seems that accessing of placeboCall (or rule) raises a page fault (?) which results in kernel panic.
Does anyone can explain the problem and help with finding a solution?