mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-06-21 15:43:21 +02:00
af_iucv: convert to getsockopt_iter
Convert IUCV socket's getsockopt implementation to use the new getsockopt_iter callback with sockopt_t. Key changes: - Replace (char __user *optval, int __user *optlen) with sockopt_t *opt - Use opt->optlen for buffer length (input) and returned size (output) - Use copy_to_iter() instead of put_user()/copy_to_user() Acked-by: Stanislav Fomichev <sdf@fomichev.me> Acked-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20260520-getsock_four-v3-1-b8c0b16b7780@debian.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
c227f8aaf2
commit
347fdd4df8
+6
-8
@@ -26,6 +26,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/uio.h>
|
||||
#include <net/sock.h>
|
||||
#include <asm/machine.h>
|
||||
#include <asm/ebcdic.h>
|
||||
@@ -1535,7 +1536,7 @@ static int iucv_sock_setsockopt(struct socket *sock, int level, int optname,
|
||||
}
|
||||
|
||||
static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,
|
||||
char __user *optval, int __user *optlen)
|
||||
sockopt_t *opt)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct iucv_sock *iucv = iucv_sk(sk);
|
||||
@@ -1545,9 +1546,7 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,
|
||||
if (level != SOL_IUCV)
|
||||
return -ENOPROTOOPT;
|
||||
|
||||
if (get_user(len, optlen))
|
||||
return -EFAULT;
|
||||
|
||||
len = opt->optlen;
|
||||
if (len < 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1574,9 +1573,8 @@ static int iucv_sock_getsockopt(struct socket *sock, int level, int optname,
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
|
||||
if (put_user(len, optlen))
|
||||
return -EFAULT;
|
||||
if (copy_to_user(optval, &val, len))
|
||||
opt->optlen = len;
|
||||
if (copy_to_iter(&val, len, &opt->iter_out) != len)
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
@@ -2228,7 +2226,7 @@ static const struct proto_ops iucv_sock_ops = {
|
||||
.socketpair = sock_no_socketpair,
|
||||
.shutdown = iucv_sock_shutdown,
|
||||
.setsockopt = iucv_sock_setsockopt,
|
||||
.getsockopt = iucv_sock_getsockopt,
|
||||
.getsockopt_iter = iucv_sock_getsockopt,
|
||||
};
|
||||
|
||||
static int iucv_sock_create(struct net *net, struct socket *sock, int protocol,
|
||||
|
||||
Reference in New Issue
Block a user