aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nilfs2/ioctl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index b44bdb291b84..d22281d60071 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -57,6 +57,14 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
57 if (argv->v_size > PAGE_SIZE) 57 if (argv->v_size > PAGE_SIZE)
58 return -EINVAL; 58 return -EINVAL;
59 59
60 /*
61 * Reject pairs of a start item position (argv->v_index) and a
62 * total count (argv->v_nmembs) which leads position 'pos' to
63 * overflow by the increment at the end of the loop.
64 */
65 if (argv->v_index > ~(__u64)0 - argv->v_nmembs)
66 return -EINVAL;
67
60 buf = (void *)__get_free_pages(GFP_NOFS, 0); 68 buf = (void *)__get_free_pages(GFP_NOFS, 0);
61 if (unlikely(!buf)) 69 if (unlikely(!buf))
62 return -ENOMEM; 70 return -ENOMEM;