netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] l2tp: l2tp_ip socket fixes
@ 2012-04-10 10:10 James Chapman
  2012-04-10 10:10 ` [PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets James Chapman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: James Chapman @ 2012-04-10 10:10 UTC (permalink / raw)
  To: netdev

A couple of small fixes for the l2tp_ip socket support. This is for
L2TPv3 IP link encapsulation.

[PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets
[PATCH 2/2] l2tp: don't overwrite source address in l2tp_ip_bind()

 net/l2tp/l2tp_ip.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets
  2012-04-10 10:10 [PATCH 0/2] l2tp: l2tp_ip socket fixes James Chapman
@ 2012-04-10 10:10 ` James Chapman
  2012-04-10 10:10 ` [PATCH 2/2] l2tp: don't overwrite source address in l2tp_ip_bind() James Chapman
  2012-04-13 15:06 ` [PATCH 0/2] l2tp: l2tp_ip socket fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: James Chapman @ 2012-04-10 10:10 UTC (permalink / raw)
  To: netdev; +Cc: James Chapman

The l2tp_ip socket close handler does not update the module refcount
correctly which prevents module unload after the first bind() call on
an L2TPv3 IP encapulation socket.

Signed-off-by: James Chapman <jchapman@katalix.com>
---
 net/l2tp/l2tp_ip.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 55670ec..b56be14 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)
 {
 	write_lock_bh(&l2tp_ip_lock);
 	hlist_del_init(&sk->sk_bind_node);
-	hlist_del_init(&sk->sk_node);
+	sk_del_node_init(sk);
 	write_unlock_bh(&l2tp_ip_lock);
 	sk_common_release(sk);
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] l2tp: don't overwrite source address in l2tp_ip_bind()
  2012-04-10 10:10 [PATCH 0/2] l2tp: l2tp_ip socket fixes James Chapman
  2012-04-10 10:10 ` [PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets James Chapman
@ 2012-04-10 10:10 ` James Chapman
  2012-04-13 15:06 ` [PATCH 0/2] l2tp: l2tp_ip socket fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: James Chapman @ 2012-04-10 10:10 UTC (permalink / raw)
  To: netdev; +Cc: James Chapman

Applications using L2TP/IP sockets want to be able to bind() an L2TP/IP
socket to set the local tunnel id while leaving the auto-assigned source
address alone. So if no source address is supplied, don't overwrite
the address already stored in the socket.

Signed-off-by: James Chapman <jchapman@katalix.com>
---
 net/l2tp/l2tp_ip.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index b56be14..585d93e 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -271,7 +271,8 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	    chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
 		goto out;
 
-	inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
+	if (addr->l2tp_addr.s_addr)
+		inet->inet_rcv_saddr = inet->inet_saddr = addr->l2tp_addr.s_addr;
 	if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
 		inet->inet_saddr = 0;  /* Use device */
 	sk_dst_reset(sk);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] l2tp: l2tp_ip socket fixes
  2012-04-10 10:10 [PATCH 0/2] l2tp: l2tp_ip socket fixes James Chapman
  2012-04-10 10:10 ` [PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets James Chapman
  2012-04-10 10:10 ` [PATCH 2/2] l2tp: don't overwrite source address in l2tp_ip_bind() James Chapman
@ 2012-04-13 15:06 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-04-13 15:06 UTC (permalink / raw)
  To: jchapman; +Cc: netdev

From: James Chapman <jchapman@katalix.com>
Date: Tue, 10 Apr 2012 11:10:41 +0100

> A couple of small fixes for the l2tp_ip socket support. This is for
> L2TPv3 IP link encapsulation.
> 
> [PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets
> [PATCH 2/2] l2tp: don't overwrite source address in l2tp_ip_bind()

Both applied, although I hope patch #2 doesn't unintentionally break
things for someone.  It's not unreasonable to think that someone may
be depending upon that saddr being set to INADDR_ANY in that case
you're changing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-13 15:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10 10:10 [PATCH 0/2] l2tp: l2tp_ip socket fixes James Chapman
2012-04-10 10:10 ` [PATCH 1/2] l2tp: fix refcount leak in l2tp_ip sockets James Chapman
2012-04-10 10:10 ` [PATCH 2/2] l2tp: don't overwrite source address in l2tp_ip_bind() James Chapman
2012-04-13 15:06 ` [PATCH 0/2] l2tp: l2tp_ip socket fixes David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).