diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/splice.c b/fs/splice.c index 4ee49e86edde..9b559ee711a8 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1179,6 +1179,9 @@ static int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n) | |||
1179 | { | 1179 | { |
1180 | int partial; | 1180 | int partial; |
1181 | 1181 | ||
1182 | if (!access_ok(VERIFY_READ, src, n)) | ||
1183 | return -EFAULT; | ||
1184 | |||
1182 | pagefault_disable(); | 1185 | pagefault_disable(); |
1183 | partial = __copy_from_user_inatomic(dst, src, n); | 1186 | partial = __copy_from_user_inatomic(dst, src, n); |
1184 | pagefault_enable(); | 1187 | pagefault_enable(); |
@@ -1231,7 +1234,7 @@ static int get_iovec_page_array(const struct iovec __user *iov, | |||
1231 | if (unlikely(!len)) | 1234 | if (unlikely(!len)) |
1232 | break; | 1235 | break; |
1233 | error = -EFAULT; | 1236 | error = -EFAULT; |
1234 | if (unlikely(!base)) | 1237 | if (!access_ok(VERIFY_READ, base, len)) |
1235 | break; | 1238 | break; |
1236 | 1239 | ||
1237 | /* | 1240 | /* |
@@ -1387,6 +1390,11 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *iov, | |||
1387 | break; | 1390 | break; |
1388 | } | 1391 | } |
1389 | 1392 | ||
1393 | if (unlikely(!access_ok(VERIFY_WRITE, base, len))) { | ||
1394 | error = -EFAULT; | ||
1395 | break; | ||
1396 | } | ||
1397 | |||
1390 | sd.len = 0; | 1398 | sd.len = 0; |
1391 | sd.total_len = len; | 1399 | sd.total_len = len; |
1392 | sd.flags = flags; | 1400 | sd.flags = flags; |