mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
nilfs2: avoid overflowing segment numbers in nilfs_ioctl_clean_segments()
nsegs is read from userspace. Limit its value and avoid overflowing nsegs
* sizeof(__u64) in the subsequent call to memdup_user().
This patch complements 481fe17e97 ("nilfs2: potential integer overflow
in nilfs_ioctl_clean_segments()").
Signed-off-by: Xi Wang <[email protected]>
Cc: Haogang Chen <[email protected]>
Acked-by: Ryusuke Konishi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
98e9685248
commit
1ecd3c7ea7
1 changed files with 2 additions and 0 deletions
|
|
@ -603,6 +603,8 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
|
|||
nsegs = argv[4].v_nmembs;
|
||||
if (argv[4].v_size != argsz[4])
|
||||
goto out;
|
||||
if (nsegs > UINT_MAX / sizeof(__u64))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* argv[4] points to segment numbers this ioctl cleans. We
|
||||
|
|
|
|||
Loading…
Reference in a new issue