aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcsock.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r--net/sunrpc/svcsock.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 01e77b8208ce..72831b8a58fb 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -960,7 +960,8 @@ static inline int svc_port_is_privileged(struct sockaddr *sin)
960static void 960static void
961svc_tcp_accept(struct svc_sock *svsk) 961svc_tcp_accept(struct svc_sock *svsk)
962{ 962{
963 struct sockaddr_in sin; 963 struct sockaddr_storage addr;
964 struct sockaddr *sin = (struct sockaddr *) &addr;
964 struct svc_serv *serv = svsk->sk_server; 965 struct svc_serv *serv = svsk->sk_server;
965 struct socket *sock = svsk->sk_sock; 966 struct socket *sock = svsk->sk_sock;
966 struct socket *newsock; 967 struct socket *newsock;
@@ -987,8 +988,7 @@ svc_tcp_accept(struct svc_sock *svsk)
987 set_bit(SK_CONN, &svsk->sk_flags); 988 set_bit(SK_CONN, &svsk->sk_flags);
988 svc_sock_enqueue(svsk); 989 svc_sock_enqueue(svsk);
989 990
990 slen = sizeof(sin); 991 err = kernel_getpeername(newsock, sin, &slen);
991 err = kernel_getpeername(newsock, (struct sockaddr *) &sin, &slen);
992 if (err < 0) { 992 if (err < 0) {
993 if (net_ratelimit()) 993 if (net_ratelimit())
994 printk(KERN_WARNING "%s: peername failed (err %d)!\n", 994 printk(KERN_WARNING "%s: peername failed (err %d)!\n",
@@ -1000,16 +1000,14 @@ svc_tcp_accept(struct svc_sock *svsk)
1000 * hosts here, but when we get encryption, the IP of the host won't 1000 * hosts here, but when we get encryption, the IP of the host won't
1001 * tell us anything. For now just warn about unpriv connections. 1001 * tell us anything. For now just warn about unpriv connections.
1002 */ 1002 */
1003 if (!svc_port_is_privileged((struct sockaddr *) &sin)) { 1003 if (!svc_port_is_privileged(sin)) {
1004 dprintk(KERN_WARNING 1004 dprintk(KERN_WARNING
1005 "%s: connect from unprivileged port: %s\n", 1005 "%s: connect from unprivileged port: %s\n",
1006 serv->sv_name, 1006 serv->sv_name,
1007 __svc_print_addr((struct sockaddr *) &sin, buf, 1007 __svc_print_addr(sin, buf, sizeof(buf)));
1008 sizeof(buf)));
1009 } 1008 }
1010 dprintk("%s: connect from %s\n", serv->sv_name, 1009 dprintk("%s: connect from %s\n", serv->sv_name,
1011 __svc_print_addr((struct sockaddr *) &sin, buf, 1010 __svc_print_addr(sin, buf, sizeof(buf)));
1012 sizeof(buf)));
1013 1011
1014 /* make sure that a write doesn't block forever when 1012 /* make sure that a write doesn't block forever when
1015 * low on memory 1013 * low on memory
@@ -1019,7 +1017,7 @@ svc_tcp_accept(struct svc_sock *svsk)
1019 if (!(newsvsk = svc_setup_socket(serv, newsock, &err, 1017 if (!(newsvsk = svc_setup_socket(serv, newsock, &err,
1020 (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY)))) 1018 (SVC_SOCK_ANONYMOUS | SVC_SOCK_TEMPORARY))))
1021 goto failed; 1019 goto failed;
1022 memcpy(&newsvsk->sk_remote, &sin, slen); 1020 memcpy(&newsvsk->sk_remote, sin, slen);
1023 newsvsk->sk_remotelen = slen; 1021 newsvsk->sk_remotelen = slen;
1024 1022
1025 svc_sock_received(newsvsk); 1023 svc_sock_received(newsvsk);