ksmbd: reject FSCTL_SET_SPARSE on directories

FSCTL_SET_SPARSE applies to files.  Return STATUS_INVALID_PARAMETER when a
client sends it for a directory handle instead of setting the sparse file
attribute on the directory.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Namjae Jeon 2026-07-08 22:17:44 +09:00
parent 159e727f76
commit 31169f4177

View File

@ -9169,6 +9169,11 @@ static inline int fsctl_set_sparse(struct ksmbd_work *work, u64 id,
if (!fp)
return -ENOENT;
if (S_ISDIR(file_inode(fp->filp)->i_mode)) {
ret = -EINVAL;
goto out;
}
if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_WRITE_ATTRIBUTES_LE))) {
ret = -EACCES;
goto out;