LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2004, 12:41 AM   #1
appas
Member
 
Registered: Jul 2004
Posts: 72

Rep: Reputation: 15
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.
 
Old 09-20-2004, 05:19 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,991

Rep: Reputation: 76
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).
 
Old 09-20-2004, 06:12 AM   #3
appas
Member
 
Registered: Jul 2004
Posts: 72

Original Poster
Rep: Reputation: 15
Thank you for the reply, I will follow the suggestion and get back.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference b/t Kernel stack and User stack hazzyb Linux - Software 2 09-29-2008 08:40 PM
"Stack Overflow" in Cedega kornerr Linux - General 5 09-09-2005 10:35 PM
kernel stack overflow prital Programming 2 06-29-2005 10:12 AM
Power PC 405 kernel stack overflow jeff_fellin Linux - General 0 01-04-2005 02:39 PM
Virtual Machine kernel stack fault in kernel mode virtical Linux - Software 0 07-14-2003 09:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration