diff options
| -rw-r--r-- | fs/compat.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/compat.c b/fs/compat.c index 7c1615183d1e..440a019256dd 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
| @@ -1222,13 +1222,14 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, | |||
| 1222 | unsigned long vlen) | 1222 | unsigned long vlen) |
| 1223 | { | 1223 | { |
| 1224 | struct file *file; | 1224 | struct file *file; |
| 1225 | int fput_needed; | ||
| 1225 | ssize_t ret; | 1226 | ssize_t ret; |
| 1226 | 1227 | ||
| 1227 | file = fget(fd); | 1228 | file = fget_light(fd, &fput_needed); |
| 1228 | if (!file) | 1229 | if (!file) |
| 1229 | return -EBADF; | 1230 | return -EBADF; |
| 1230 | ret = compat_readv(file, vec, vlen, &file->f_pos); | 1231 | ret = compat_readv(file, vec, vlen, &file->f_pos); |
| 1231 | fput(file); | 1232 | fput_light(file, fput_needed); |
| 1232 | return ret; | 1233 | return ret; |
| 1233 | } | 1234 | } |
| 1234 | 1235 | ||
| @@ -1238,15 +1239,16 @@ compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec, | |||
| 1238 | { | 1239 | { |
| 1239 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; | 1240 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; |
| 1240 | struct file *file; | 1241 | struct file *file; |
| 1242 | int fput_needed; | ||
| 1241 | ssize_t ret; | 1243 | ssize_t ret; |
| 1242 | 1244 | ||
| 1243 | if (pos < 0) | 1245 | if (pos < 0) |
| 1244 | return -EINVAL; | 1246 | return -EINVAL; |
| 1245 | file = fget(fd); | 1247 | file = fget_light(fd, &fput_needed); |
| 1246 | if (!file) | 1248 | if (!file) |
| 1247 | return -EBADF; | 1249 | return -EBADF; |
| 1248 | ret = compat_readv(file, vec, vlen, &pos); | 1250 | ret = compat_readv(file, vec, vlen, &pos); |
| 1249 | fput(file); | 1251 | fput_light(file, fput_needed); |
| 1250 | return ret; | 1252 | return ret; |
| 1251 | } | 1253 | } |
| 1252 | 1254 | ||
| @@ -1277,13 +1279,14 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec, | |||
| 1277 | unsigned long vlen) | 1279 | unsigned long vlen) |
| 1278 | { | 1280 | { |
| 1279 | struct file *file; | 1281 | struct file *file; |
| 1282 | int fput_needed; | ||
| 1280 | ssize_t ret; | 1283 | ssize_t ret; |
| 1281 | 1284 | ||
| 1282 | file = fget(fd); | 1285 | file = fget_light(fd, &fput_needed); |
| 1283 | if (!file) | 1286 | if (!file) |
| 1284 | return -EBADF; | 1287 | return -EBADF; |
| 1285 | ret = compat_writev(file, vec, vlen, &file->f_pos); | 1288 | ret = compat_writev(file, vec, vlen, &file->f_pos); |
| 1286 | fput(file); | 1289 | fput_light(file, fput_needed); |
| 1287 | return ret; | 1290 | return ret; |
| 1288 | } | 1291 | } |
| 1289 | 1292 | ||
| @@ -1293,15 +1296,16 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec, | |||
| 1293 | { | 1296 | { |
| 1294 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; | 1297 | loff_t pos = ((loff_t)pos_high << 32) | pos_low; |
| 1295 | struct file *file; | 1298 | struct file *file; |
| 1299 | int fput_needed; | ||
| 1296 | ssize_t ret; | 1300 | ssize_t ret; |
| 1297 | 1301 | ||
| 1298 | if (pos < 0) | 1302 | if (pos < 0) |
| 1299 | return -EINVAL; | 1303 | return -EINVAL; |
| 1300 | file = fget(fd); | 1304 | file = fget_light(fd, &fput_needed); |
| 1301 | if (!file) | 1305 | if (!file) |
| 1302 | return -EBADF; | 1306 | return -EBADF; |
| 1303 | ret = compat_writev(file, vec, vlen, &pos); | 1307 | ret = compat_writev(file, vec, vlen, &pos); |
| 1304 | fput(file); | 1308 | fput_light(file, fput_needed); |
| 1305 | return ret; | 1309 | return ret; |
| 1306 | } | 1310 | } |
| 1307 | 1311 | ||
