summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorHaogang Chen2011-12-20 02:11:56 +0100
committerLinus Torvalds2011-12-20 19:25:04 +0100
commit481fe17e973fb97aa3edf17c69557afe88d8334f (patch)
tree3ab58a5f35345d7e61fc4428b18529705ceab1e5 /mm/memcontrol.c
parentnilfs2: unbreak compat ioctl (diff)
downloadkernel-qcow2-linux-481fe17e973fb97aa3edf17c69557afe88d8334f.tar.gz
kernel-qcow2-linux-481fe17e973fb97aa3edf17c69557afe88d8334f.tar.xz
kernel-qcow2-linux-481fe17e973fb97aa3edf17c69557afe88d8334f.zip
nilfs2: potential integer overflow in nilfs_ioctl_clean_segments()
There is a potential integer overflow in nilfs_ioctl_clean_segments(). When a large argv[n].v_nmembs is passed from the userspace, the subsequent call to vmalloc() will allocate a buffer smaller than expected, which leads to out-of-bound access in nilfs_ioctl_move_blocks() and lfs_clean_segments(). The following check does not prevent the overflow because nsegs is also controlled by the userspace and could be very large. if (argv[n].v_nmembs > nsegs * nilfs->ns_blocks_per_segment) goto out_free; This patch clamps argv[n].v_nmembs to UINT_MAX / argv[n].v_size, and returns -EINVAL when overflow. Signed-off-by: Haogang Chen <haogangchen@gmail.com> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
0 files changed, 0 insertions, 0 deletions