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>

authored by Andrew Morton and committed by Linus Torvalds 78ae87c3 4c738480

+11 -3
+11 -3
fs/ioctl.c
··· 12 12 #include <linux/fs.h> 13 13 #include <linux/security.h> 14 14 #include <linux/module.h> 15 + #include <linux/kallsyms.h> 15 16 16 17 #include <asm/uaccess.h> 17 18 #include <asm/ioctls.h> ··· 21 20 unsigned long arg) 22 21 { 23 22 int error = -ENOTTY; 23 + void *f; 24 24 25 25 if (!filp->f_op) 26 26 goto out; ··· 31 29 if (error == -ENOIOCTLCMD) 32 30 error = -EINVAL; 33 31 goto out; 34 - } else if (filp->f_op->ioctl) { 32 + } else if ((f = filp->f_op->ioctl)) { 35 33 lock_kernel(); 36 - error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, 37 - filp, cmd, arg); 34 + if (!filp->f_op->ioctl) { 35 + printk("%s: ioctl %p disappeared\n", __FUNCTION__, f); 36 + print_symbol("symbol: %s\n", (unsigned long)f); 37 + dump_stack(); 38 + } else { 39 + error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, 40 + filp, cmd, arg); 41 + } 38 42 unlock_kernel(); 39 43 } 40 44