mirror of
https://github.com/torvalds/linux.git
synced 2026-10-12 13:27:02 +02:00
ksmbd: allow FSCTL_SET_SPARSE without input buffer
FSCTL_SET_SPARSE without an input buffer sets a file sparse. Treat a zero-length input buffer as SetSparse=true and keep rejecting truncated non-empty buffers. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
31169f4177
commit
86c84cc760
|
|
@ -9487,15 +9487,21 @@ int smb2_ioctl(struct ksmbd_work *work)
|
|||
rsp);
|
||||
break;
|
||||
case FSCTL_SET_SPARSE:
|
||||
if (in_buf_len < sizeof(struct file_sparse)) {
|
||||
{
|
||||
struct file_sparse sparse = {0};
|
||||
|
||||
if (in_buf_len && in_buf_len < sizeof(struct file_sparse)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = fsctl_set_sparse(work, id, (struct file_sparse *)buffer);
|
||||
*(u8 *)&sparse = 1;
|
||||
ret = fsctl_set_sparse(work, id, in_buf_len ?
|
||||
(struct file_sparse *)buffer : &sparse);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
break;
|
||||
}
|
||||
case FSCTL_SET_ZERO_DATA:
|
||||
{
|
||||
struct file_zero_data_information *zero_data;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user