fix mips sys32_p{read,write}
PATCH 1/1 fix mips sys32_p{read,write}
Switched to use of sys_pread64()/sys_pwrite64() rather than keep duplicating their guts; among the little things that had been missing there were such as
ret = security_file_permission (file, MAY_READ);
Gotta love the LSM robustness, right?
Signed-off-by Al Viro <[email protected]>
---
arch/mips/kernel/linux32.c | 64 +------------------------------------------- 1 files changed, 2 insertions(+), 62 deletions(-)
ed1914b47f964ab580f7e837df011c4a0f197ab6
arch/mips/kernel/linux32.c +2 -62
@@ -356,73 +356,13 @@ asmlinkage int sys32_llseek(unsigned int asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf,size_t count,u32 unused,u64 a4,u64 a5) { -ssize_t ret; -struct file * file; -ssize_t (*read)(struct file *,char __user *,size_t ,loff_t *); -loff_t pos; - - ret = -EBADF ; - file =fget (fd); -if (!file) - goto bad_file; -if (!(file->f_mode &FMODE_READ )) - goto out; - pos =merge_64 (a4, a5); - ret =rw_verify_area (READ , file, &pos, count); -if (ret <0 ) - goto out; - ret = -EINVAL ; -if (!file->f_op || !(read = file->f_op->read)) - goto out; -if (pos <0 ) - goto out; - ret = -ESPIPE ; -if (!(file->f_mode &FMODE_PREAD )) - goto out; - ret =read (file, buf, count, &pos); -if (ret >0 ) -dnotify_parent (file->f_dentry,DN_ACCESS ); -out: -fput (file); -bad_file: -return ret; +return sys_pread64 (fd, buf, count,merge_64 (a4, a5)); } asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf,size_t count,u32 unused,u64 a4,u64 a5) { -ssize_t ret; -struct file * file; -ssize_t (*write)(struct file *,const char __user *,size_t ,loff_t *); -loff_t pos; - - ret = -EBADF ; - file =fget (fd); -if (!file) - goto bad_file; -if (!(file->f_mode &FMODE_WRITE )) - goto out; - pos =merge_64 (a4, a5); - ret =rw_verify_area (WRITE , file, &pos, count); -if (ret <0 ) - goto out; - ret = -EINVAL ; -if (!file->f_op || !(write = file->f_op->write)) - goto out; -if (pos <0 ) - goto out; - - ret = -ESPIPE ; -if (!(file->f_mode &FMODE_PWRITE )) - goto out; - - ret =write (file, buf, count, &pos); -if (ret >0 ) -dnotify_parent (file->f_dentry,DN_MODIFY ); -out: -fput (file); -bad_file: -return ret; +return sys_pwrite64 (fd, buf, count,merge_64 (a4, a5)); } asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
Signature · 1 line
1.3.0.g0080f