add_timer crashes the kernel,Why?

Raz raziebe at gmail.com
Mon Dec 20 03:43:11 EST 2010


try to remove mytimer from stack

On Mon, Dec 20, 2010 at 10:27 AM, lijin liu <llj098 at gmail.com> wrote:

> Hello everyone!
>
> I want to use the timer in my kernel module. I read the book  _Linux
> kernel development 3rd version_  and LDD 3rd version.
>
> Both the two books tell me write the code like this:
>
> struct timer_list my_timer;
> init_timer(&my_timer);
>
> my_timer.expires = jiffies + wait;
> my_timer.data = 0;
> my_timer.function=my_function;
>
> //active the timer:
> add_timer(&timer);
>
>
> When I insmod the module, the kernel crashed, and when I change my
> code to *mod_timer* rather than add_timer.
>
> It just works!
>
> But why the add_timer crash the kernel?
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20101220/379fbea7/attachment.html 


More information about the Kernelnewbies mailing list