diff options
| author | Mark Brown <broonie@kernel.org> | 2026-07-23 14:50:06 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-07-23 14:50:06 +0100 |
| commit | 63ffd29793580ce1b3e66f2d0278153ec680c323 (patch) | |
| tree | 4e4015d50031f9afc74e3867d1a5c13e1975ca46 /include/linux/net.h | |
| parent | cbb9335c899458fba61392e28c22e12470de1e50 (diff) | |
| parent | 1df10cef2d1e7f9f2fb7eddb67fc70d3abf101f9 (diff) | |
| download | linux-next-63ffd29793580ce1b3e66f2d0278153ec680c323.tar.gz linux-next-63ffd29793580ce1b3e66f2d0278153ec680c323.zip | |
Merge branch 'main' of https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
# Conflicts:
# MAINTAINERS
# drivers/net/amt.c
Diffstat (limited to 'include/linux/net.h')
| -rw-r--r-- | include/linux/net.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index fdcf9956805c..3d82966e2243 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -47,6 +47,29 @@ typedef struct sockopt { int optlen; } sockopt_t; +/* + * Initialize a user-backed sockopt_t from the (optval, optlen) __user pair of + * a getsockopt() callback. Used by transitional __user getsockopt wrappers + * while the proto-layer callbacks are converted to take a sockopt_t; the + * caller writes opt->optlen back to the user optlen after the callback. + */ +static inline int sockopt_init_user(sockopt_t *opt, char __user *optval, + int __user *optlen) +{ + int len; + + if (get_user(len, optlen)) + return -EFAULT; + if (len < 0) + return -EINVAL; + + iov_iter_ubuf(&opt->iter_out, ITER_DEST, optval, len); + iov_iter_ubuf(&opt->iter_in, ITER_SOURCE, optval, len); + opt->optlen = len; + + return 0; +} + struct poll_table_struct; struct pipe_inode_info; struct inode; |
