forked from luck/tmp_suning_uos_patched
net/udp: switch udp_lib_setsockopt to sockptr_t
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
894cfbc0cf
commit
91ac1ccaff
|
@ -306,7 +306,7 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
|
|||
int udp_lib_getsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, int __user *optlen);
|
||||
int udp_lib_setsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, unsigned int optlen,
|
||||
sockptr_t optval, unsigned int optlen,
|
||||
int (*push_pending_frames)(struct sock *));
|
||||
struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
|
||||
__be32 daddr, __be16 dport, int dif);
|
||||
|
|
|
@ -2588,7 +2588,7 @@ void udp_destroy_sock(struct sock *sk)
|
|||
* Socket option code for UDP
|
||||
*/
|
||||
int udp_lib_setsockopt(struct sock *sk, int level, int optname,
|
||||
char __user *optval, unsigned int optlen,
|
||||
sockptr_t optval, unsigned int optlen,
|
||||
int (*push_pending_frames)(struct sock *))
|
||||
{
|
||||
struct udp_sock *up = udp_sk(sk);
|
||||
|
@ -2599,7 +2599,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
|
|||
if (optlen < sizeof(int))
|
||||
return -EINVAL;
|
||||
|
||||
if (get_user(val, (int __user *)optval))
|
||||
if (copy_from_sockptr(&val, optval, sizeof(val)))
|
||||
return -EFAULT;
|
||||
|
||||
valbool = val ? 1 : 0;
|
||||
|
@ -2707,7 +2707,8 @@ int udp_setsockopt(struct sock *sk, int level, int optname,
|
|||
char __user *optval, unsigned int optlen)
|
||||
{
|
||||
if (level == SOL_UDP || level == SOL_UDPLITE)
|
||||
return udp_lib_setsockopt(sk, level, optname, optval, optlen,
|
||||
return udp_lib_setsockopt(sk, level, optname,
|
||||
USER_SOCKPTR(optval), optlen,
|
||||
udp_push_pending_frames);
|
||||
return ip_setsockopt(sk, level, optname, optval, optlen);
|
||||
}
|
||||
|
|
|
@ -1622,7 +1622,8 @@ int udpv6_setsockopt(struct sock *sk, int level, int optname,
|
|||
char __user *optval, unsigned int optlen)
|
||||
{
|
||||
if (level == SOL_UDP || level == SOL_UDPLITE)
|
||||
return udp_lib_setsockopt(sk, level, optname, optval, optlen,
|
||||
return udp_lib_setsockopt(sk, level, optname,
|
||||
USER_SOCKPTR(optval), optlen,
|
||||
udp_v6_push_pending_frames);
|
||||
return ipv6_setsockopt(sk, level, optname, optval, optlen);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user