diff options
Diffstat (limited to 'net/sctp/socket.c')
| -rw-r--r-- | net/sctp/socket.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0b338eca6dc0..e6926cb19420 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -4368,15 +4368,11 @@ static struct sk_buff *sctp_skb_recv_datagram(struct sock *sk, int flags, | |||
| 4368 | * However, this function was corrent in any case. 8) | 4368 | * However, this function was corrent in any case. 8) |
| 4369 | */ | 4369 | */ |
| 4370 | if (flags & MSG_PEEK) { | 4370 | if (flags & MSG_PEEK) { |
| 4371 | unsigned long cpu_flags; | 4371 | spin_lock_bh(&sk->sk_receive_queue.lock); |
| 4372 | |||
| 4373 | sctp_spin_lock_irqsave(&sk->sk_receive_queue.lock, | ||
| 4374 | cpu_flags); | ||
| 4375 | skb = skb_peek(&sk->sk_receive_queue); | 4372 | skb = skb_peek(&sk->sk_receive_queue); |
| 4376 | if (skb) | 4373 | if (skb) |
| 4377 | atomic_inc(&skb->users); | 4374 | atomic_inc(&skb->users); |
| 4378 | sctp_spin_unlock_irqrestore(&sk->sk_receive_queue.lock, | 4375 | spin_unlock_bh(&sk->sk_receive_queue.lock); |
| 4379 | cpu_flags); | ||
| 4380 | } else { | 4376 | } else { |
| 4381 | skb = skb_dequeue(&sk->sk_receive_queue); | 4377 | skb = skb_dequeue(&sk->sk_receive_queue); |
| 4382 | } | 4378 | } |
| @@ -4686,6 +4682,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
| 4686 | struct sctp_endpoint *newep = newsp->ep; | 4682 | struct sctp_endpoint *newep = newsp->ep; |
| 4687 | struct sk_buff *skb, *tmp; | 4683 | struct sk_buff *skb, *tmp; |
| 4688 | struct sctp_ulpevent *event; | 4684 | struct sctp_ulpevent *event; |
| 4685 | int flags = 0; | ||
| 4689 | 4686 | ||
| 4690 | /* Migrate socket buffer sizes and all the socket level options to the | 4687 | /* Migrate socket buffer sizes and all the socket level options to the |
| 4691 | * new socket. | 4688 | * new socket. |
| @@ -4707,6 +4704,17 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
| 4707 | sctp_sk(newsk)->bind_hash = pp; | 4704 | sctp_sk(newsk)->bind_hash = pp; |
| 4708 | inet_sk(newsk)->num = inet_sk(oldsk)->num; | 4705 | inet_sk(newsk)->num = inet_sk(oldsk)->num; |
| 4709 | 4706 | ||
| 4707 | /* Copy the bind_addr list from the original endpoint to the new | ||
| 4708 | * endpoint so that we can handle restarts properly | ||
| 4709 | */ | ||
| 4710 | if (assoc->peer.ipv4_address) | ||
| 4711 | flags |= SCTP_ADDR4_PEERSUPP; | ||
| 4712 | if (assoc->peer.ipv6_address) | ||
| 4713 | flags |= SCTP_ADDR6_PEERSUPP; | ||
| 4714 | sctp_bind_addr_copy(&newsp->ep->base.bind_addr, | ||
| 4715 | &oldsp->ep->base.bind_addr, | ||
| 4716 | SCTP_SCOPE_GLOBAL, GFP_KERNEL, flags); | ||
| 4717 | |||
| 4710 | /* Move any messages in the old socket's receive queue that are for the | 4718 | /* Move any messages in the old socket's receive queue that are for the |
| 4711 | * peeled off association to the new socket's receive queue. | 4719 | * peeled off association to the new socket's receive queue. |
| 4712 | */ | 4720 | */ |
