Commit 78ae87c3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

vanishing ioctl handler debugging

We've had several reoprts of the CPU jumping to 0x00000000 is do_ioctl().  I
assume that there's a race and someone is zeroing out the ioctl handler while
this CPU waits for the lock_kernel().

The patch adds code to detect this, then emits stuff which will hopefuly lead
us to the culprit.
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4c738480
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kallsyms.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/ioctls.h> #include <asm/ioctls.h>
...@@ -20,6 +21,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd, ...@@ -20,6 +21,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
int error = -ENOTTY; int error = -ENOTTY;
void *f;
if (!filp->f_op) if (!filp->f_op)
goto out; goto out;
...@@ -29,10 +31,16 @@ static long do_ioctl(struct file *filp, unsigned int cmd, ...@@ -29,10 +31,16 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
if (error == -ENOIOCTLCMD) if (error == -ENOIOCTLCMD)
error = -EINVAL; error = -EINVAL;
goto out; goto out;
} else if (filp->f_op->ioctl) { } else if ((f = filp->f_op->ioctl)) {
lock_kernel(); lock_kernel();
error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, if (!filp->f_op->ioctl) {
filp, cmd, arg); printk("%s: ioctl %p disappeared\n", __FUNCTION__, f);
print_symbol("symbol: %s\n", (unsigned long)f);
dump_stack();
} else {
error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
filp, cmd, arg);
}
unlock_kernel(); unlock_kernel();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment