a few bugfixes (now with patches)
Subsystems (3)
cover a few bugfixes (now with patches)
Sorry, now with the patches that follow...
-vlad
PATCH 2/2 Unmap v4mapped addresses during SCTP_BINDX_REM_ADDR operation.
From: Paolo Galtieri <[email protected]>
During the sctp_bindx() call to add additional addresses to the endpoint, any v4mapped addresses are converted and stored as regular v4 addresses. However, when trying to remove these addresses, the v4mapped addresses are not converted and the operation fails. This patch unmaps the addresses on during the remove operation as well.
--- net/sctp/socket.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
net/sctp/socket.c +6 -0
@@ -627,6 +627,12 @@ int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) retval = -EINVAL ; goto err_bindx_rem; } + +if (!af->addr_valid (sa_addr, sp,NULL )) { + retval = -EADDRNOTAVAIL ; + goto err_bindx_rem; + } +if (sa_addr->v4.sin_port !=htons (bp->port)) { retval = -EINVAL ; goto err_bindx_rem;
Signature · 1 line
1.5.0.3.438.gc49b2
PATCH 1/2 Fix assertion (!atomic_read(&sk->sk_rmem_alloc)) failed message
In reply to Vlad YasevichFrom: Tsutomu Fujii <[email protected]>
In current implementation, LKSCTP does receive buffer accounting for data in sctp_receive_queue and pd_lobby. However, LKSCTP don't do accounting for data in frag_list when data is fragmented. In addition, LKSCTP doesn't do accounting for data in reasm and lobby queue in structure sctp_ulpq.
When there are date in these queue, assertion failed message is printed in inet_sock_destruct because sk_rmem_alloc of oldsk does not become 0 when socket is destroyed.
--- net/sctp/socket.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 44 insertions(+), 4 deletions(-)
net/sctp/socket.c +44 -4
@@ -5638,6 +5638,36 @@ void sctp_wait_for_close(struct sock *sk, long timeout)finish_wait (sk->sk_sleep, &wait); } +static void sctp_sock_rfree_frag (struct sk_buff *skb) +{ +struct sk_buff *frag; + +if (!skb->data_len) + goto done; + +/* Don't forget the fragments. */ +for (frag =skb_shinfo (skb)->frag_list; frag; frag = frag->next) +sctp_sock_rfree_frag (frag); + +done: +sctp_sock_rfree (skb); +} + +static void sctp_skb_set_owner_r_frag (struct sk_buff *skb,struct sock *sk) +{ +struct sk_buff *frag; + +if (!skb->data_len) + goto done; + +/* Don't forget the fragments. */ +for (frag =skb_shinfo (skb)->frag_list; frag; frag = frag->next) +sctp_skb_set_owner_r_frag (frag, sk); + +done: +sctp_skb_set_owner_r (skb, sk); +} +/* Populate the fields of the newsk from the oldsk and migrate the assoc * and its messages to the newsk. */
@@ -5692,10 +5722,10 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,sctp_skb_for_each (skb, &oldsk->sk_receive_queue, tmp) { event =sctp_skb2event (skb);if (event->asoc == assoc) { -sctp_sock_rfree (skb); +sctp_sock_rfree_frag (skb);__skb_unlink (skb, &oldsk->sk_receive_queue);__skb_queue_tail (&newsk->sk_receive_queue, skb); -sctp_skb_set_owner_r (skb, newsk); +sctp_skb_set_owner_r_frag (skb, newsk); } }
@@ -5723,10 +5753,10 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,sctp_skb_for_each (skb, &oldsp->pd_lobby, tmp) { event =sctp_skb2event (skb);if (event->asoc == assoc) { -sctp_sock_rfree (skb); +sctp_sock_rfree_frag (skb);__skb_unlink (skb, &oldsp->pd_lobby);__skb_queue_tail (queue, skb); -sctp_skb_set_owner_r (skb, newsk); +sctp_skb_set_owner_r_frag (skb, newsk); } }
@@ -5738,6 +5768,16 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, } +sctp_skb_for_each (skb, &assoc->ulpq.reasm, tmp) { +sctp_sock_rfree_frag (skb); +sctp_skb_set_owner_r_frag (skb, newsk); + } + +sctp_skb_for_each (skb, &assoc->ulpq.lobby, tmp) { +sctp_sock_rfree_frag (skb); +sctp_skb_set_owner_r_frag (skb, newsk); + } +/* Set the type of socket to indicate that it is peeled off from the * original UDP-style socket or created with the accept() call on a * TCP-style socket..
Signature · 1 line
1.5.0.3.438.gc49b2
David Miller
maintainerRe: [PATCH 1/2] [SCTP] Fix assertion (!atomic_read(&sk->sk_rmem_alloc)) failed message
From: Vlad Yasevich <[email protected]>
Date: Tue, 10 Apr 2007 17:21:23 -0400
Quoted 11 lines
From: Tsutomu Fujii <[email protected]>
In current implementation, LKSCTP does receive buffer accounting for data in
sctp_receive_queueandpd_lobby. However, LKSCTP don't do accounting for data infrag_listwhen data is fragmented. In addition, LKSCTP doesn't do accounting for data in reasm and lobby queue in structuresctp_ulpq.
When there are date in these queue, assertion failed message is printed ininet_sock_destructbecausesk_rmem_allocof oldsk does not become 0 when socket is destroyed.
Quoted 2 lines
Signed-off-by Tsutomu Fujii <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>
Patch applied.
David Miller
maintainerRe: [PATCH 2/2] [SCTP] Unmap v4mapped addresses during SCTP_BINDX_REM_ADDR operation.
In reply to Vlad YasevichFrom: Vlad Yasevich <[email protected]>
Date: Tue, 10 Apr 2007 17:21:24 -0400
Quoted 10 lines
From: Paolo Galtieri <[email protected]>
During the
sctp_bindx()call to add additional addresses to the endpoint, any v4mapped addresses are converted and stored as regular v4 addresses. However, when trying to remove these addresses, the v4mapped addresses are not converted and the operation fails. This patch unmaps the addresses on during the remove operation as well.Signed-off-by Paolo Galtieri <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>
Patch applied, thank you.