[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1388197696-4648-1-git-send-email-fanwlexca@gmail.com>
Date: Sat, 28 Dec 2013 10:28:16 +0800
From: Wenliang Fan <fanwlexca@...il.com>
To: slava@...eyko.com, konishi.ryusuke@....ntt.co.jp
Cc: linux-nilfs@...r.kernel.org, linux-kernel@...r.kernel.org,
Wenliang Fan <fanwlexca@...il.com>
Subject: [PATCH] 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;
Signed-off-by: Wenliang Fan <fanwlexca@...il.com>
---
fs/nilfs2/ioctl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index b44bdb2..a260a98 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -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;
--
1.8.5.rc1.28.g7061504
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists