diff options
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/fs/compat.c b/fs/compat.c index c580c322fa6b..f6fd0a00e6cc 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -257,7 +257,7 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs * | |||
257 | } | 257 | } |
258 | 258 | ||
259 | /* | 259 | /* |
260 | * The following statfs calls are copies of code from fs/open.c and | 260 | * The following statfs calls are copies of code from fs/statfs.c and |
261 | * should be checked against those from time to time | 261 | * should be checked against those from time to time |
262 | */ | 262 | */ |
263 | asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) | 263 | asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) |
@@ -320,7 +320,9 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat | |||
320 | __put_user(kbuf->f_namelen, &ubuf->f_namelen) || | 320 | __put_user(kbuf->f_namelen, &ubuf->f_namelen) || |
321 | __put_user(kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]) || | 321 | __put_user(kbuf->f_fsid.val[0], &ubuf->f_fsid.val[0]) || |
322 | __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]) || | 322 | __put_user(kbuf->f_fsid.val[1], &ubuf->f_fsid.val[1]) || |
323 | __put_user(kbuf->f_frsize, &ubuf->f_frsize)) | 323 | __put_user(kbuf->f_frsize, &ubuf->f_frsize) || |
324 | __put_user(kbuf->f_flags, &ubuf->f_flags) || | ||
325 | __clear_user(ubuf->f_spare, sizeof(ubuf->f_spare))) | ||
324 | return -EFAULT; | 326 | return -EFAULT; |
325 | return 0; | 327 | return 0; |
326 | } | 328 | } |
@@ -597,10 +599,8 @@ ssize_t compat_rw_copy_check_uvector(int type, | |||
597 | if (nr_segs > fast_segs) { | 599 | if (nr_segs > fast_segs) { |
598 | ret = -ENOMEM; | 600 | ret = -ENOMEM; |
599 | iov = kmalloc(nr_segs*sizeof(struct iovec), GFP_KERNEL); | 601 | iov = kmalloc(nr_segs*sizeof(struct iovec), GFP_KERNEL); |
600 | if (iov == NULL) { | 602 | if (iov == NULL) |
601 | *ret_pointer = fast_pointer; | ||
602 | goto out; | 603 | goto out; |
603 | } | ||
604 | } | 604 | } |
605 | *ret_pointer = iov; | 605 | *ret_pointer = iov; |
606 | 606 | ||
@@ -1350,6 +1350,10 @@ static int compat_count(compat_uptr_t __user *argv, int max) | |||
1350 | argv++; | 1350 | argv++; |
1351 | if (i++ >= max) | 1351 | if (i++ >= max) |
1352 | return -E2BIG; | 1352 | return -E2BIG; |
1353 | |||
1354 | if (fatal_signal_pending(current)) | ||
1355 | return -ERESTARTNOHAND; | ||
1356 | cond_resched(); | ||
1353 | } | 1357 | } |
1354 | } | 1358 | } |
1355 | return i; | 1359 | return i; |
@@ -1391,6 +1395,12 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, | |||
1391 | while (len > 0) { | 1395 | while (len > 0) { |
1392 | int offset, bytes_to_copy; | 1396 | int offset, bytes_to_copy; |
1393 | 1397 | ||
1398 | if (fatal_signal_pending(current)) { | ||
1399 | ret = -ERESTARTNOHAND; | ||
1400 | goto out; | ||
1401 | } | ||
1402 | cond_resched(); | ||
1403 | |||
1394 | offset = pos % PAGE_SIZE; | 1404 | offset = pos % PAGE_SIZE; |
1395 | if (offset == 0) | 1405 | if (offset == 0) |
1396 | offset = PAGE_SIZE; | 1406 | offset = PAGE_SIZE; |
@@ -1407,18 +1417,8 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, | |||
1407 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { | 1417 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { |
1408 | struct page *page; | 1418 | struct page *page; |
1409 | 1419 | ||
1410 | #ifdef CONFIG_STACK_GROWSUP | 1420 | page = get_arg_page(bprm, pos, 1); |
1411 | ret = expand_stack_downwards(bprm->vma, pos); | 1421 | if (!page) { |
1412 | if (ret < 0) { | ||
1413 | /* We've exceed the stack rlimit. */ | ||
1414 | ret = -E2BIG; | ||
1415 | goto out; | ||
1416 | } | ||
1417 | #endif | ||
1418 | ret = get_user_pages(current, bprm->mm, pos, | ||
1419 | 1, 1, 1, &page, NULL); | ||
1420 | if (ret <= 0) { | ||
1421 | /* We've exceed the stack rlimit. */ | ||
1422 | ret = -E2BIG; | 1422 | ret = -E2BIG; |
1423 | goto out; | 1423 | goto out; |
1424 | } | 1424 | } |
@@ -1539,8 +1539,10 @@ int compat_do_execve(char * filename, | |||
1539 | return retval; | 1539 | return retval; |
1540 | 1540 | ||
1541 | out: | 1541 | out: |
1542 | if (bprm->mm) | 1542 | if (bprm->mm) { |
1543 | acct_arg_size(bprm, 0); | ||
1543 | mmput(bprm->mm); | 1544 | mmput(bprm->mm); |
1545 | } | ||
1544 | 1546 | ||
1545 | out_file: | 1547 | out_file: |
1546 | if (bprm->file) { | 1548 | if (bprm->file) { |