aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_ppp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp/l2tp_ppp.c')
-rw-r--r--net/l2tp/l2tp_ppp.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 5ebee2ded9e9..be5fadf34739 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -197,8 +197,6 @@ static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock,
197 if (sk->sk_state & PPPOX_BOUND) 197 if (sk->sk_state & PPPOX_BOUND)
198 goto end; 198 goto end;
199 199
200 msg->msg_namelen = 0;
201
202 err = 0; 200 err = 0;
203 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 201 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
204 flags & MSG_DONTWAIT, &err); 202 flags & MSG_DONTWAIT, &err);
@@ -353,7 +351,9 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
353 goto error_put_sess_tun; 351 goto error_put_sess_tun;
354 } 352 }
355 353
354 local_bh_disable();
356 l2tp_xmit_skb(session, skb, session->hdr_len); 355 l2tp_xmit_skb(session, skb, session->hdr_len);
356 local_bh_enable();
357 357
358 sock_put(ps->tunnel_sock); 358 sock_put(ps->tunnel_sock);
359 sock_put(sk); 359 sock_put(sk);
@@ -422,7 +422,9 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
422 skb->data[0] = ppph[0]; 422 skb->data[0] = ppph[0];
423 skb->data[1] = ppph[1]; 423 skb->data[1] = ppph[1];
424 424
425 local_bh_disable();
425 l2tp_xmit_skb(session, skb, session->hdr_len); 426 l2tp_xmit_skb(session, skb, session->hdr_len);
427 local_bh_enable();
426 428
427 sock_put(sk_tun); 429 sock_put(sk_tun);
428 sock_put(sk); 430 sock_put(sk);
@@ -906,8 +908,8 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
906#if IS_ENABLED(CONFIG_IPV6) 908#if IS_ENABLED(CONFIG_IPV6)
907 } else if ((tunnel->version == 2) && 909 } else if ((tunnel->version == 2) &&
908 (tunnel->sock->sk_family == AF_INET6)) { 910 (tunnel->sock->sk_family == AF_INET6)) {
909 struct ipv6_pinfo *np = inet6_sk(tunnel->sock);
910 struct sockaddr_pppol2tpin6 sp; 911 struct sockaddr_pppol2tpin6 sp;
912
911 len = sizeof(sp); 913 len = sizeof(sp);
912 memset(&sp, 0, len); 914 memset(&sp, 0, len);
913 sp.sa_family = AF_PPPOX; 915 sp.sa_family = AF_PPPOX;
@@ -920,13 +922,13 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
920 sp.pppol2tp.d_session = session->peer_session_id; 922 sp.pppol2tp.d_session = session->peer_session_id;
921 sp.pppol2tp.addr.sin6_family = AF_INET6; 923 sp.pppol2tp.addr.sin6_family = AF_INET6;
922 sp.pppol2tp.addr.sin6_port = inet->inet_dport; 924 sp.pppol2tp.addr.sin6_port = inet->inet_dport;
923 memcpy(&sp.pppol2tp.addr.sin6_addr, &np->daddr, 925 memcpy(&sp.pppol2tp.addr.sin6_addr, &tunnel->sock->sk_v6_daddr,
924 sizeof(np->daddr)); 926 sizeof(tunnel->sock->sk_v6_daddr));
925 memcpy(uaddr, &sp, len); 927 memcpy(uaddr, &sp, len);
926 } else if ((tunnel->version == 3) && 928 } else if ((tunnel->version == 3) &&
927 (tunnel->sock->sk_family == AF_INET6)) { 929 (tunnel->sock->sk_family == AF_INET6)) {
928 struct ipv6_pinfo *np = inet6_sk(tunnel->sock);
929 struct sockaddr_pppol2tpv3in6 sp; 930 struct sockaddr_pppol2tpv3in6 sp;
931
930 len = sizeof(sp); 932 len = sizeof(sp);
931 memset(&sp, 0, len); 933 memset(&sp, 0, len);
932 sp.sa_family = AF_PPPOX; 934 sp.sa_family = AF_PPPOX;
@@ -939,8 +941,8 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr,
939 sp.pppol2tp.d_session = session->peer_session_id; 941 sp.pppol2tp.d_session = session->peer_session_id;
940 sp.pppol2tp.addr.sin6_family = AF_INET6; 942 sp.pppol2tp.addr.sin6_family = AF_INET6;
941 sp.pppol2tp.addr.sin6_port = inet->inet_dport; 943 sp.pppol2tp.addr.sin6_port = inet->inet_dport;
942 memcpy(&sp.pppol2tp.addr.sin6_addr, &np->daddr, 944 memcpy(&sp.pppol2tp.addr.sin6_addr, &tunnel->sock->sk_v6_daddr,
943 sizeof(np->daddr)); 945 sizeof(tunnel->sock->sk_v6_daddr));
944 memcpy(uaddr, &sp, len); 946 memcpy(uaddr, &sp, len);
945#endif 947#endif
946 } else if (tunnel->version == 3) { 948 } else if (tunnel->version == 3) {