diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/net/socket.c b/net/socket.c index 9eac5c394134..abf3e2561521 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -209,8 +209,8 @@ int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr) | |||
209 | * specified. Zero is returned for a success. | 209 | * specified. Zero is returned for a success. |
210 | */ | 210 | */ |
211 | 211 | ||
212 | int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, | 212 | static int move_addr_to_user(struct sockaddr *kaddr, int klen, |
213 | int __user *ulen) | 213 | void __user *uaddr, int __user *ulen) |
214 | { | 214 | { |
215 | int err; | 215 | int err; |
216 | int len; | 216 | int len; |
@@ -536,14 +536,13 @@ void sock_release(struct socket *sock) | |||
536 | } | 536 | } |
537 | EXPORT_SYMBOL(sock_release); | 537 | EXPORT_SYMBOL(sock_release); |
538 | 538 | ||
539 | int sock_tx_timestamp(struct msghdr *msg, struct sock *sk, | 539 | int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) |
540 | union skb_shared_tx *shtx) | ||
541 | { | 540 | { |
542 | shtx->flags = 0; | 541 | *tx_flags = 0; |
543 | if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE)) | 542 | if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE)) |
544 | shtx->hardware = 1; | 543 | *tx_flags |= SKBTX_HW_TSTAMP; |
545 | if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE)) | 544 | if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE)) |
546 | shtx->software = 1; | 545 | *tx_flags |= SKBTX_SW_TSTAMP; |
547 | return 0; | 546 | return 0; |
548 | } | 547 | } |
549 | EXPORT_SYMBOL(sock_tx_timestamp); | 548 | EXPORT_SYMBOL(sock_tx_timestamp); |
@@ -663,7 +662,8 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, | |||
663 | } | 662 | } |
664 | EXPORT_SYMBOL_GPL(__sock_recv_timestamp); | 663 | EXPORT_SYMBOL_GPL(__sock_recv_timestamp); |
665 | 664 | ||
666 | inline void sock_recv_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) | 665 | static inline void sock_recv_drops(struct msghdr *msg, struct sock *sk, |
666 | struct sk_buff *skb) | ||
667 | { | 667 | { |
668 | if (sock_flag(sk, SOCK_RXQ_OVFL) && skb && skb->dropcount) | 668 | if (sock_flag(sk, SOCK_RXQ_OVFL) && skb && skb->dropcount) |
669 | put_cmsg(msg, SOL_SOCKET, SO_RXQ_OVFL, | 669 | put_cmsg(msg, SOL_SOCKET, SO_RXQ_OVFL, |
@@ -1920,7 +1920,8 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) | |||
1920 | * Afterwards, it will be a kernel pointer. Thus the compiler-assisted | 1920 | * Afterwards, it will be a kernel pointer. Thus the compiler-assisted |
1921 | * checking falls down on this. | 1921 | * checking falls down on this. |
1922 | */ | 1922 | */ |
1923 | if (copy_from_user(ctl_buf, (void __user *)msg_sys.msg_control, | 1923 | if (copy_from_user(ctl_buf, |
1924 | (void __user __force *)msg_sys.msg_control, | ||
1924 | ctl_len)) | 1925 | ctl_len)) |
1925 | goto out_freectl; | 1926 | goto out_freectl; |
1926 | msg_sys.msg_control = ctl_buf; | 1927 | msg_sys.msg_control = ctl_buf; |
@@ -3055,14 +3056,19 @@ int kernel_getsockopt(struct socket *sock, int level, int optname, | |||
3055 | char *optval, int *optlen) | 3056 | char *optval, int *optlen) |
3056 | { | 3057 | { |
3057 | mm_segment_t oldfs = get_fs(); | 3058 | mm_segment_t oldfs = get_fs(); |
3059 | char __user *uoptval; | ||
3060 | int __user *uoptlen; | ||
3058 | int err; | 3061 | int err; |
3059 | 3062 | ||
3063 | uoptval = (char __user __force *) optval; | ||
3064 | uoptlen = (int __user __force *) optlen; | ||
3065 | |||
3060 | set_fs(KERNEL_DS); | 3066 | set_fs(KERNEL_DS); |
3061 | if (level == SOL_SOCKET) | 3067 | if (level == SOL_SOCKET) |
3062 | err = sock_getsockopt(sock, level, optname, optval, optlen); | 3068 | err = sock_getsockopt(sock, level, optname, uoptval, uoptlen); |
3063 | else | 3069 | else |
3064 | err = sock->ops->getsockopt(sock, level, optname, optval, | 3070 | err = sock->ops->getsockopt(sock, level, optname, uoptval, |
3065 | optlen); | 3071 | uoptlen); |
3066 | set_fs(oldfs); | 3072 | set_fs(oldfs); |
3067 | return err; | 3073 | return err; |
3068 | } | 3074 | } |
@@ -3072,13 +3078,16 @@ int kernel_setsockopt(struct socket *sock, int level, int optname, | |||
3072 | char *optval, unsigned int optlen) | 3078 | char *optval, unsigned int optlen) |
3073 | { | 3079 | { |
3074 | mm_segment_t oldfs = get_fs(); | 3080 | mm_segment_t oldfs = get_fs(); |
3081 | char __user *uoptval; | ||
3075 | int err; | 3082 | int err; |
3076 | 3083 | ||
3084 | uoptval = (char __user __force *) optval; | ||
3085 | |||
3077 | set_fs(KERNEL_DS); | 3086 | set_fs(KERNEL_DS); |
3078 | if (level == SOL_SOCKET) | 3087 | if (level == SOL_SOCKET) |
3079 | err = sock_setsockopt(sock, level, optname, optval, optlen); | 3088 | err = sock_setsockopt(sock, level, optname, uoptval, optlen); |
3080 | else | 3089 | else |
3081 | err = sock->ops->setsockopt(sock, level, optname, optval, | 3090 | err = sock->ops->setsockopt(sock, level, optname, uoptval, |
3082 | optlen); | 3091 | optlen); |
3083 | set_fs(oldfs); | 3092 | set_fs(oldfs); |
3084 | return err; | 3093 | return err; |