LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   stack overflow in linux kernel module (https://www.linuxquestions.org/questions/programming-9/stack-overflow-in-linux-kernel-module-232756/)

appas 09-19-2004 11:41 PM

stack overflow in linux kernel module
 
Hi all,
I am writing a linux kernel module to find the mount point from 'struct file'. I get the 'f_vfsmnt struct' from 'struct file' and recursively use the 'dentry' structure and 'qstr' to get the mount point .
When i load the module, i am getting do_IRQ stack overflow error in my module and the system hangs after somtime.
Could someone help me with the reasons for stack overflow in kernel module or an alternate way to get the mount point from 'struct file' or filedescriptor.
I can post the code if needed.

rjlee 09-20-2004 04:19 AM

When you say “recursive” I'm guessing you mean recursive function calls, and it's the call stack that's overflowing.

When you're running in kernel mode, you have a very limited stack as for speed you're not allowed to swap the stack registers to RAM. In general, you shouldn't try to recurse more than three or four function calls.

You should be able to re-write the code using a while() or do…while() loop to avoid the recursive functions. See the quicksort routine in the kernel source for an example (the option to include it is near the end of menuconfig).

appas 09-20-2004 05:12 AM

Thank you for the reply, I will follow the suggestion and get back.


All times are GMT -5. The time now is 04:49 AM.