summaryrefslogtreecommitdiff
path: root/include/asm-mips/ip32/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2026-04-08 03:30:30 -0700
committerJakub Kicinski <kuba@kernel.org>2026-04-13 14:56:28 -0700
commit5bd0dec150f56b6307d599132dcb7c01007bbecc (patch)
treeed81356e11248c0bcf8e91ad249fb9aa657bf00d /include/asm-mips/ip32/git@git.tavy.me:linux.git
parent67fab22a7adcec0279b9b057eb3dc669e32834f0 (diff)
net: call getsockopt_iter if available
Update do_sock_getsockopt() to use the new getsockopt_iter callback when available. Add do_sock_getsockopt_iter() helper that: 1. Reads optlen from user/kernel space 2. Initializes a sockopt_t with the appropriate iov_iter (kvec for kernel, ubuf for user buffers) and sets opt.optlen 3. Calls the protocol's getsockopt_iter callback 4. Writes opt.optlen back to user/kernel space The optlen is always written back, even on failure. Some protocols (e.g. CAN raw) return -ERANGE and set optlen to the required buffer size so userspace knows how much to allocate. The callback is responsible for setting opt.optlen to indicate the returned data size. Important to say that iov_out does not need to be copied back in do_sock_getsockopt(). When optval is not kernel (the userspace path), sockptr_to_sockopt() sets up opt->iter_out as a ITER_DEST ubuf iterator pointing directly at the userspace buffer (optval.user). So when getsockopt_iter implementations call copy_to_iter(..., &opt->iter_out), the data is written directly to userspace — no intermediate kernel buffer is involved. When optval.is_kernel is true (the in-kernel path, e.g. from io_uring), the kvec points at the already-provided kernel buffer (optval.kernel), so the data lands in the caller's buffer directly via the kvec-backed iterator. In both cases the iterator writes to the final destination in-place at protocol callback. There's nothing to copy back — only optlen needs to be written back. Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20260408-getsockopt-v3-2-061bb9cb355d@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/asm-mips/ip32/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions