Skip to content

Commit 4e89b72

Browse files
author
Al Viro
committed
fix multiplication overflow in copy_fdtable()
cpy and set really should be size_t; we won't get an overflow on that, since sysctl_nr_open can't be set above ~(size_t)0 / sizeof(void *), so nr that would've managed to overflow size_t on that multiplication won't get anywhere near copy_fdtable() - we'll fail with EMFILE before that. Cc: stable@kernel.org # v2.6.25+ Fixes: 9cfe015 (get rid of NR_OPEN and introduce a sysctl_nr_open) Reported-by: Thiago Macieira <thiago.macieira@intel.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent b0d3869 commit 4e89b72

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
7070
*/
7171
static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)
7272
{
73-
unsigned int cpy, set;
73+
size_t cpy, set;
7474

7575
BUG_ON(nfdt->max_fds < ofdt->max_fds);
7676

0 commit comments

Comments
 (0)