Lines Matching +full:e +full:- +full:fuse

1 // SPDX-License-Identifier: GPL-2.0-only
18 args->out_args[0].size = sizeof(*outarg); in fuse_send_ioctl()
19 args->out_args[0].value = outarg; in fuse_send_ioctl()
24 if (ret == -ENOSYS) in fuse_send_ioctl()
25 ret = -ENOTTY; in fuse_send_ioctl()
27 if (ret >= 0 && outarg->result == -ENOSYS) in fuse_send_ioctl()
28 outarg->result = -ENOTTY; in fuse_send_ioctl()
50 * non-compat (i.e. ones coming from 64bit apps) ioctl in fuse_copy_ioctl_iovec_old()
54 return -EINVAL; in fuse_copy_ioctl_iovec_old()
65 return -EIO; in fuse_copy_ioctl_iovec_old()
76 u32 max = fc->max_pages << PAGE_SHIFT; in fuse_verify_ioctl_iov()
79 if (iov->iov_len > (size_t) max) in fuse_verify_ioctl_iov()
80 return -ENOMEM; in fuse_verify_ioctl_iov()
81 max -= iov->iov_len; in fuse_verify_ioctl_iov()
93 if (fc->minor < 16) { in fuse_copy_ioctl_iovec()
99 return -EIO; in fuse_copy_ioctl_iovec()
105 return -EIO; in fuse_copy_ioctl_iovec()
114 return -EIO; in fuse_copy_ioctl_iovec()
121 /* For fs-verity, determine iov lengths from input */
127 if (copy_from_user(&digest_size, &uarg->digest_size, sizeof(digest_size))) in fuse_setup_measure_verity()
128 return -EFAULT; in fuse_setup_measure_verity()
130 if (digest_size > SIZE_MAX - sizeof(struct fsverity_digest)) in fuse_setup_measure_verity()
131 return -EINVAL; in fuse_setup_measure_verity()
133 iov->iov_len = sizeof(struct fsverity_digest) + digest_size; in fuse_setup_measure_verity()
146 return -EFAULT; in fuse_setup_enable_verity()
149 return -ENOMEM; in fuse_setup_enable_verity()
155 iov->iov_base = u64_to_user_ptr(enable.salt_ptr); in fuse_setup_enable_verity()
156 iov->iov_len = enable.salt_size; in fuse_setup_enable_verity()
163 iov->iov_base = u64_to_user_ptr(enable.sig_ptr); in fuse_setup_enable_verity()
164 iov->iov_len = enable.sig_size; in fuse_setup_enable_verity()
173 * copying but FUSE has no idea whatsoever about what to copy in or
176 * This is solved by allowing FUSE server to retry ioctl with
185 * On the first callout to FUSE server, inarg->in_size and
186 * inarg->out_size will be NULL; then, the server completes the ioctl
187 * with FUSE_IOCTL_RETRY set in out->flags, out->in_iovs set to 1 and
192 * which tells FUSE to copy in the requested area and retry the ioctl.
195 * it sets FUSE_IOCTL_RETRY, out->in_iovs to 2 and iov array to
200 * FUSE will copy both struct a and the pointed buffer from the
204 * This time, FUSE server has everything it needs and completes ioctl
212 * limits ioctl data transfers to well-formed ioctls and is the forced
213 * behavior for all FUSE servers.
218 struct fuse_file *ff = file->private_data; in fuse_do_ioctl()
219 struct fuse_mount *fm = ff->fm; in fuse_do_ioctl()
221 .fh = ff->fh, in fuse_do_ioctl()
251 err = -ENOMEM; in fuse_do_ioctl()
252 ap.pages = fuse_pages_alloc(fm->fc->max_pages, GFP_KERNEL, &ap.descs); in fuse_do_ioctl()
257 fuse_page_descs_length_init(ap.descs, 0, fm->fc->max_pages); in fuse_do_ioctl()
266 iov->iov_base = (void __user *)arg; in fuse_do_ioctl()
267 iov->iov_len = _IOC_SIZE(cmd); in fuse_do_ioctl()
304 err = -ENOMEM; in fuse_do_ioctl()
305 if (max_pages > fm->fc->max_pages) in fuse_do_ioctl()
317 ap.args.nodeid = ff->nodeid; in fuse_do_ioctl()
326 err = -EFAULT; in fuse_do_ioctl()
350 err = -EIO; in fuse_do_ioctl()
361 err = -ENOMEM; in fuse_do_ioctl()
368 err = fuse_copy_ioctl_iovec(fm->fc, iov_page, vaddr, in fuse_do_ioctl()
378 err = fuse_verify_ioctl_iov(fm->fc, in_iov, in_iovs); in fuse_do_ioctl()
382 err = fuse_verify_ioctl_iov(fm->fc, out_iov, out_iovs); in fuse_do_ioctl()
389 err = -EIO; in fuse_do_ioctl()
393 err = -EFAULT; in fuse_do_ioctl()
404 __free_page(ap.pages[--ap.num_pages]); in fuse_do_ioctl()
418 return -EACCES; in fuse_ioctl_common()
421 return -EIO; in fuse_ioctl_common()
440 struct fuse_mount *fm = ff->fm; in fuse_priv_ioctl()
447 inarg.fh = ff->fh; in fuse_priv_ioctl()
453 if (S_ISDIR(inode->i_mode)) in fuse_priv_ioctl()
462 args.nodeid = ff->nodeid; in fuse_priv_ioctl()
477 err = -EIO; in fuse_priv_ioctl()
485 bool isdir = S_ISDIR(inode->i_mode); in fuse_priv_ioctl_prepare()
487 if (!fuse_allow_current_process(fm->fc)) in fuse_priv_ioctl_prepare()
488 return ERR_PTR(-EACCES); in fuse_priv_ioctl_prepare()
491 return ERR_PTR(-EIO); in fuse_priv_ioctl_prepare()
493 if (!S_ISREG(inode->i_mode) && !isdir) in fuse_priv_ioctl_prepare()
494 return ERR_PTR(-ENOTTY); in fuse_priv_ioctl_prepare()
501 fuse_file_release(inode, ff, O_RDONLY, NULL, S_ISDIR(inode->i_mode)); in fuse_priv_ioctl_cleanup()
516 if (fa->flags_valid) { in fuse_fileattr_get()
530 fa->fsx_extsize = xfa.fsx_extsize; in fuse_fileattr_get()
531 fa->fsx_nextents = xfa.fsx_nextents; in fuse_fileattr_get()
532 fa->fsx_projid = xfa.fsx_projid; in fuse_fileattr_get()
533 fa->fsx_cowextsize = xfa.fsx_cowextsize; in fuse_fileattr_get()
546 unsigned int flags = fa->flags; in fuse_fileattr_set()
554 if (fa->flags_valid) { in fuse_fileattr_set()
561 xfa.fsx_xflags = fa->fsx_xflags; in fuse_fileattr_set()
562 xfa.fsx_extsize = fa->fsx_extsize; in fuse_fileattr_set()
563 xfa.fsx_nextents = fa->fsx_nextents; in fuse_fileattr_set()
564 xfa.fsx_projid = fa->fsx_projid; in fuse_fileattr_set()
565 xfa.fsx_cowextsize = fa->fsx_cowextsize; in fuse_fileattr_set()