aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp/l2tp_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp/l2tp_ip.c')
-rw-r--r--net/l2tp/l2tp_ip.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 55670ec3cd0f..6274f0be82b0 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -232,7 +232,7 @@ static void l2tp_ip_close(struct sock *sk, long timeout)
232{ 232{
233 write_lock_bh(&l2tp_ip_lock); 233 write_lock_bh(&l2tp_ip_lock);
234 hlist_del_init(&sk->sk_bind_node); 234 hlist_del_init(&sk->sk_bind_node);
235 hlist_del_init(&sk->sk_node); 235 sk_del_node_init(sk);
236 write_unlock_bh(&l2tp_ip_lock); 236 write_unlock_bh(&l2tp_ip_lock);
237 sk_common_release(sk); 237 sk_common_release(sk);
238} 238}
@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
271 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) 271 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
272 goto out; 272 goto out;
273 273
274 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr; 274 if (addr->l2tp_addr.s_addr)
275 inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
275 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST) 276 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
276 inet->inet_saddr = 0; /* Use device */ 277 inet->inet_saddr = 0; /* Use device */
277 sk_dst_reset(sk); 278 sk_dst_reset(sk);
@@ -441,8 +442,9 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
441 442
442 daddr = lip->l2tp_addr.s_addr; 443 daddr = lip->l2tp_addr.s_addr;
443 } else { 444 } else {
445 rc = -EDESTADDRREQ;
444 if (sk->sk_state != TCP_ESTABLISHED) 446 if (sk->sk_state != TCP_ESTABLISHED)
445 return -EDESTADDRREQ; 447 goto out;
446 448
447 daddr = inet->inet_daddr; 449 daddr = inet->inet_daddr;
448 connected = 1; 450 connected = 1;