- f = fdget(args.fd);
- if (!f.file) return -EBADF;
- fops = f.file->f_op;
- if (!fops) fops = dummy_fops;
- fdput(f);
- if (copy_to_user((struct file_operations __user *)args.retp, fops, sizeof(*fops))) return -EINVAL;
+ filp = fget(args.fd);
+ if (!filp) return -EBADF;
+ if (filp->f_op) ioctl_method = filp->f_op->unlocked_ioctl;
+ lookup_symbol_name_((unsigned long)ioctl_method, ioctl_method_name);
+ if (strcmp(ioctl_method_name, "block_ioctl") == 0) {
+ struct block_device *bdev = I_BDEV(filp->f_mapping->host);
+ ioctl_method = bdev->bd_disk->fops->ioctl;
+ lookup_symbol_name_((unsigned long)ioctl_method, ioctl_method_name);
+ }
+ fput(filp);
+ if (copy_to_user((struct file_operations __user *)args.retp, ioctl_method_name, KSYM_NAME_LEN)) return -EINVAL;