aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 55efdfebdf5a..e99048c21c56 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1195,16 +1195,12 @@ out:
1195 return ret; 1195 return ret;
1196} 1196}
1197 1197
1198asmlinkage ssize_t 1198static size_t compat_readv(struct file *file,
1199compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen) 1199 const struct compat_iovec __user *vec,
1200 unsigned long vlen, loff_t *pos)
1200{ 1201{
1201 struct file *file;
1202 ssize_t ret = -EBADF; 1202 ssize_t ret = -EBADF;
1203 1203
1204 file = fget(fd);
1205 if (!file)
1206 return -EBADF;
1207
1208 if (!(file->f_mode & FMODE_READ)) 1204 if (!(file->f_mode & FMODE_READ))
1209 goto out; 1205 goto out;
1210 1206
@@ -1212,12 +1208,26 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, unsign
1212 if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read)) 1208 if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read))
1213 goto out; 1209 goto out;
1214 1210
1215 ret = compat_do_readv_writev(READ, file, vec, vlen, &file->f_pos); 1211 ret = compat_do_readv_writev(READ, file, vec, vlen, pos);
1216 1212
1217out: 1213out:
1218 if (ret > 0) 1214 if (ret > 0)
1219 add_rchar(current, ret); 1215 add_rchar(current, ret);
1220 inc_syscr(current); 1216 inc_syscr(current);
1217 return ret;
1218}
1219
1220asmlinkage ssize_t
1221compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
1222 unsigned long vlen)
1223{
1224 struct file *file;
1225 ssize_t ret;
1226
1227 file = fget(fd);
1228 if (!file)
1229 return -EBADF;
1230 ret = compat_readv(file, vec, vlen, &file->f_pos);
1221 fput(file); 1231 fput(file);
1222 return ret; 1232 return ret;
1223} 1233}