Loading fs/ioctl.c +84 −80 Original line number Diff line number Diff line Loading @@ -12,8 +12,8 @@ #include <linux/fs.h> #include <linux/security.h> #include <linux/module.h> #include <linux/uaccess.h> #include <asm/uaccess.h> #include <asm/ioctls.h> static long do_ioctl(struct file *filp, unsigned int cmd, Loading Loading @@ -58,9 +58,9 @@ static int file_ioctl(struct file *filp, unsigned int cmd, return -EINVAL; if (!capable(CAP_SYS_RAWIO)) return -EPERM; if ((error = get_user(block, p)) != 0) error = get_user(block, p); if (error) return error; lock_kernel(); res = mapping->a_ops->bmap(mapping, block); unlock_kernel(); Loading @@ -82,7 +82,8 @@ static int file_ioctl(struct file *filp, unsigned int cmd, * vfs_ioctl() is not for drivers and not intended to be EXPORT_SYMBOL()'d. * It's just a simple helper for sys_ioctl and compat_sys_ioctl. */ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg) int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg) { unsigned int flag; int on, error = 0; Loading @@ -97,7 +98,8 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon break; case FIONBIO: if ((error = get_user(on, (int __user *)arg)) != 0) error = get_user(on, (int __user *)arg); if (error) break; flag = O_NONBLOCK; #ifdef __sparc__ Loading @@ -112,7 +114,8 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon break; case FIOASYNC: if ((error = get_user(on, (int __user *)arg)) != 0) error = get_user(on, (int __user *)arg); if (error) break; flag = on ? FASYNC : 0; Loading @@ -122,8 +125,8 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon lock_kernel(); error = filp->f_op->fasync(fd, filp, on); unlock_kernel(); } else error = -ENOTTY; } else error = -ENOTTY; } if (error != 0) break; Loading @@ -138,10 +141,11 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) || S_ISREG(filp->f_path.dentry->d_inode->i_mode) || S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) { loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode); error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; } else loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode); error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; } else error = -ENOTTY; break; default: Loading Loading
fs/ioctl.c +84 −80 Original line number Diff line number Diff line Loading @@ -12,8 +12,8 @@ #include <linux/fs.h> #include <linux/security.h> #include <linux/module.h> #include <linux/uaccess.h> #include <asm/uaccess.h> #include <asm/ioctls.h> static long do_ioctl(struct file *filp, unsigned int cmd, Loading Loading @@ -58,9 +58,9 @@ static int file_ioctl(struct file *filp, unsigned int cmd, return -EINVAL; if (!capable(CAP_SYS_RAWIO)) return -EPERM; if ((error = get_user(block, p)) != 0) error = get_user(block, p); if (error) return error; lock_kernel(); res = mapping->a_ops->bmap(mapping, block); unlock_kernel(); Loading @@ -82,7 +82,8 @@ static int file_ioctl(struct file *filp, unsigned int cmd, * vfs_ioctl() is not for drivers and not intended to be EXPORT_SYMBOL()'d. * It's just a simple helper for sys_ioctl and compat_sys_ioctl. */ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg) int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned long arg) { unsigned int flag; int on, error = 0; Loading @@ -97,7 +98,8 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon break; case FIONBIO: if ((error = get_user(on, (int __user *)arg)) != 0) error = get_user(on, (int __user *)arg); if (error) break; flag = O_NONBLOCK; #ifdef __sparc__ Loading @@ -112,7 +114,8 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon break; case FIOASYNC: if ((error = get_user(on, (int __user *)arg)) != 0) error = get_user(on, (int __user *)arg); if (error) break; flag = on ? FASYNC : 0; Loading @@ -122,8 +125,8 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon lock_kernel(); error = filp->f_op->fasync(fd, filp, on); unlock_kernel(); } else error = -ENOTTY; } else error = -ENOTTY; } if (error != 0) break; Loading @@ -138,10 +141,11 @@ int vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, unsigned lon if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) || S_ISREG(filp->f_path.dentry->d_inode->i_mode) || S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) { loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode); error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; } else loff_t res = inode_get_bytes(filp->f_path.dentry->d_inode); error = copy_to_user((loff_t __user *)arg, &res, sizeof(res)) ? -EFAULT : 0; } else error = -ENOTTY; break; default: Loading