aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 0644a154672b..8b41dcdcdc67 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1378,6 +1378,10 @@ static int compat_count(compat_uptr_t __user *argv, int max)
1378 argv++; 1378 argv++;
1379 if (i++ >= max) 1379 if (i++ >= max)
1380 return -E2BIG; 1380 return -E2BIG;
1381
1382 if (fatal_signal_pending(current))
1383 return -ERESTARTNOHAND;
1384 cond_resched();
1381 } 1385 }
1382 } 1386 }
1383 return i; 1387 return i;
@@ -1419,6 +1423,12 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv,
1419 while (len > 0) { 1423 while (len > 0) {
1420 int offset, bytes_to_copy; 1424 int offset, bytes_to_copy;
1421 1425
1426 if (fatal_signal_pending(current)) {
1427 ret = -ERESTARTNOHAND;
1428 goto out;
1429 }
1430 cond_resched();
1431
1422 offset = pos % PAGE_SIZE; 1432 offset = pos % PAGE_SIZE;
1423 if (offset == 0) 1433 if (offset == 0)
1424 offset = PAGE_SIZE; 1434 offset = PAGE_SIZE;
@@ -1435,18 +1445,8 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv,
1435 if (!kmapped_page || kpos != (pos & PAGE_MASK)) { 1445 if (!kmapped_page || kpos != (pos & PAGE_MASK)) {
1436 struct page *page; 1446 struct page *page;
1437 1447
1438#ifdef CONFIG_STACK_GROWSUP 1448 page = get_arg_page(bprm, pos, 1);
1439 ret = expand_stack_downwards(bprm->vma, pos); 1449 if (!page) {
1440 if (ret < 0) {
1441 /* We've exceed the stack rlimit. */
1442 ret = -E2BIG;
1443 goto out;
1444 }
1445#endif
1446 ret = get_user_pages(current, bprm->mm, pos,
1447 1, 1, 1, &page, NULL);
1448 if (ret <= 0) {
1449 /* We've exceed the stack rlimit. */
1450 ret = -E2BIG; 1450 ret = -E2BIG;
1451 goto out; 1451 goto out;
1452 } 1452 }
@@ -1567,8 +1567,10 @@ int compat_do_execve(char * filename,
1567 return retval; 1567 return retval;
1568 1568
1569out: 1569out:
1570 if (bprm->mm) 1570 if (bprm->mm) {
1571 acct_arg_size(bprm, 0);
1571 mmput(bprm->mm); 1572 mmput(bprm->mm);
1573 }
1572 1574
1573out_file: 1575out_file:
1574 if (bprm->file) { 1576 if (bprm->file) {