fs/nilfs2: Integer overflow in nilfs_ioctl_wrap_copy()
PATCH 1/1 fs/nilfs2: Integer overflow in nilfs_ioctl_wrap_copy()
The local variable 'pos' comes from userspace. If a large number was passed, there would be an integer overflow in the following line:
pos += n;
--- fs/nilfs2/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nilfs2/ioctl.c +2 -0
@@ -65,6 +65,8 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, ret =0 ; total =0 ; pos = argv->v_index; +if (pos >ULONG_MAX - argv->v_nmembs) +return -EINVAL ;for (i =0 ; i < argv->v_nmembs; i += n) { n = (argv->v_nmembs - i < maxmembs) ? argv->v_nmembs - i : maxmembs;
Signature · 6 lines
1.8.5.rc1.28.g7061504 -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Vyacheslav Dubeyko
maintainerHi,
Quoted 14 lines · Wenliang Fan
The local variable 'pos' comes from userspace. If a large number was passed, there would be an integer overflow in the following line:
pos += n;Signed-off-by Wenliang Fan <[email protected]>--- fs/nilfs2/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)fs/nilfs2/ioctl.c +0
-0
fs/nilfs2/ioctl.c static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, · line 69
Quoted 5 lines
fs/nilfs2/ioctl.c +2
-0@@ -65,6 +65,8 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, ret =0 ; total =0 ; pos = argv->v_index; +if (pos >ULONG_MAX - argv->v_nmembs) +return -EINVAL ;
I am slightly confused. Does this patch means that you refused previous one? Or this patch is addition to the previous one?
You need to prepare next version of the patch or to prepare patch set from two patches. And it makes sense to provide changelog of your work, I think.
Thanks,
Vyacheslav Dubeyko.
fs/nilfs2/ioctl.c static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, · line 72
Quoted 3 lines
fs/nilfs2/ioctl.c +0
-0for (i =0 ; i < argv->v_nmembs; i += n) { n = (argv->v_nmembs - i < maxmembs) ? argv->v_nmembs - i : maxmembs;
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html