diff options
| author | Andrew Morton <akpm@linux-foundation.org> | 2007-06-03 16:50:41 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-04 16:25:10 -0400 |
| commit | 78ae87c3cd723c8a8dcd67d4e4cbc6d63671c108 (patch) | |
| tree | ba550d1d94a11b8f758f905e40c3d2aa7494007d | |
| parent | 4c738480d21a190e3d99c7ce985ab9484f373a3c (diff) | |
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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | fs/ioctl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c index 479c1038ed4a..8c90cbc903fa 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
| 13 | #include <linux/security.h> | 13 | #include <linux/security.h> |
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/kallsyms.h> | ||
| 15 | 16 | ||
| 16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
| 17 | #include <asm/ioctls.h> | 18 | #include <asm/ioctls.h> |
| @@ -20,6 +21,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd, | |||
| 20 | unsigned long arg) | 21 | unsigned long arg) |
| 21 | { | 22 | { |
| 22 | int error = -ENOTTY; | 23 | int error = -ENOTTY; |
| 24 | void *f; | ||
| 23 | 25 | ||
| 24 | if (!filp->f_op) | 26 | if (!filp->f_op) |
| 25 | goto out; | 27 | goto out; |
| @@ -29,10 +31,16 @@ static long do_ioctl(struct file *filp, unsigned int cmd, | |||
| 29 | if (error == -ENOIOCTLCMD) | 31 | if (error == -ENOIOCTLCMD) |
| 30 | error = -EINVAL; | 32 | error = -EINVAL; |
| 31 | goto out; | 33 | goto out; |
| 32 | } else if (filp->f_op->ioctl) { | 34 | } else if ((f = filp->f_op->ioctl)) { |
| 33 | lock_kernel(); | 35 | lock_kernel(); |
| 34 | error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, | 36 | if (!filp->f_op->ioctl) { |
| 35 | filp, cmd, arg); | 37 | printk("%s: ioctl %p disappeared\n", __FUNCTION__, f); |
| 38 | print_symbol("symbol: %s\n", (unsigned long)f); | ||
| 39 | dump_stack(); | ||
| 40 | } else { | ||
| 41 | error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, | ||
| 42 | filp, cmd, arg); | ||
| 43 | } | ||
| 36 | unlock_kernel(); | 44 | unlock_kernel(); |
| 37 | } | 45 | } |
| 38 | 46 | ||
