mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
ext4: check if mount_opts is NUL-terminated in ext4_ioctl_set_tune_sb()
params.mount_opts may come as potentially non-NUL-term string. Userspace is expected to pass a NUL-term string. Add an extra check to ensure this holds true. Note that further code utilizes strscpy_pad() so this is just for proper informing the user of incorrect data being provided. Found by Linux Verification Center (linuxtesting.org). Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru> Reviewed-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Message-ID: <20251101160430.222297-2-pchelkin@ispras.ru> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org
This commit is contained in:
committed by
Theodore Ts'o
parent
ee5a977b4e
commit
3db63d2c2d
@@ -1394,6 +1394,10 @@ static int ext4_ioctl_set_tune_sb(struct file *filp,
|
||||
if (copy_from_user(¶ms, in, sizeof(params)))
|
||||
return -EFAULT;
|
||||
|
||||
if (strnlen(params.mount_opts, sizeof(params.mount_opts)) ==
|
||||
sizeof(params.mount_opts))
|
||||
return -E2BIG;
|
||||
|
||||
if ((params.set_flags & ~TUNE_OPS_SUPPORTED) != 0)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user