diff options
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 9de6a698f91d..eec4ff456e33 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -633,9 +633,9 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct udp_table *udptable) | |||
633 | if (!inet->recverr) { | 633 | if (!inet->recverr) { |
634 | if (!harderr || sk->sk_state != TCP_ESTABLISHED) | 634 | if (!harderr || sk->sk_state != TCP_ESTABLISHED) |
635 | goto out; | 635 | goto out; |
636 | } else { | 636 | } else |
637 | ip_icmp_error(sk, skb, err, uh->dest, info, (u8 *)(uh+1)); | 637 | ip_icmp_error(sk, skb, err, uh->dest, info, (u8 *)(uh+1)); |
638 | } | 638 | |
639 | sk->sk_err = err; | 639 | sk->sk_err = err; |
640 | sk->sk_error_report(sk); | 640 | sk->sk_error_report(sk); |
641 | out: | 641 | out: |
@@ -1063,10 +1063,11 @@ static unsigned int first_packet_length(struct sock *sk) | |||
1063 | spin_unlock_bh(&rcvq->lock); | 1063 | spin_unlock_bh(&rcvq->lock); |
1064 | 1064 | ||
1065 | if (!skb_queue_empty(&list_kill)) { | 1065 | if (!skb_queue_empty(&list_kill)) { |
1066 | lock_sock_bh(sk); | 1066 | bool slow = lock_sock_fast(sk); |
1067 | |||
1067 | __skb_queue_purge(&list_kill); | 1068 | __skb_queue_purge(&list_kill); |
1068 | sk_mem_reclaim_partial(sk); | 1069 | sk_mem_reclaim_partial(sk); |
1069 | unlock_sock_bh(sk); | 1070 | unlock_sock_fast(sk, slow); |
1070 | } | 1071 | } |
1071 | return res; | 1072 | return res; |
1072 | } | 1073 | } |
@@ -1123,6 +1124,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1123 | int peeked; | 1124 | int peeked; |
1124 | int err; | 1125 | int err; |
1125 | int is_udplite = IS_UDPLITE(sk); | 1126 | int is_udplite = IS_UDPLITE(sk); |
1127 | bool slow; | ||
1126 | 1128 | ||
1127 | /* | 1129 | /* |
1128 | * Check any passed addresses | 1130 | * Check any passed addresses |
@@ -1197,10 +1199,10 @@ out: | |||
1197 | return err; | 1199 | return err; |
1198 | 1200 | ||
1199 | csum_copy_err: | 1201 | csum_copy_err: |
1200 | lock_sock_bh(sk); | 1202 | slow = lock_sock_fast(sk); |
1201 | if (!skb_kill_datagram(sk, skb, flags)) | 1203 | if (!skb_kill_datagram(sk, skb, flags)) |
1202 | UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); | 1204 | UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); |
1203 | unlock_sock_bh(sk); | 1205 | unlock_sock_fast(sk, slow); |
1204 | 1206 | ||
1205 | if (noblock) | 1207 | if (noblock) |
1206 | return -EAGAIN; | 1208 | return -EAGAIN; |
@@ -1625,9 +1627,9 @@ int udp_rcv(struct sk_buff *skb) | |||
1625 | 1627 | ||
1626 | void udp_destroy_sock(struct sock *sk) | 1628 | void udp_destroy_sock(struct sock *sk) |
1627 | { | 1629 | { |
1628 | lock_sock_bh(sk); | 1630 | bool slow = lock_sock_fast(sk); |
1629 | udp_flush_pending_frames(sk); | 1631 | udp_flush_pending_frames(sk); |
1630 | unlock_sock_bh(sk); | 1632 | unlock_sock_fast(sk, slow); |
1631 | } | 1633 | } |
1632 | 1634 | ||
1633 | /* | 1635 | /* |
@@ -1686,8 +1688,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
1686 | return -ENOPROTOOPT; | 1688 | return -ENOPROTOOPT; |
1687 | if (val != 0 && val < 8) /* Illegal coverage: use default (8) */ | 1689 | if (val != 0 && val < 8) /* Illegal coverage: use default (8) */ |
1688 | val = 8; | 1690 | val = 8; |
1689 | else if (val > USHORT_MAX) | 1691 | else if (val > USHRT_MAX) |
1690 | val = USHORT_MAX; | 1692 | val = USHRT_MAX; |
1691 | up->pcslen = val; | 1693 | up->pcslen = val; |
1692 | up->pcflag |= UDPLITE_SEND_CC; | 1694 | up->pcflag |= UDPLITE_SEND_CC; |
1693 | break; | 1695 | break; |
@@ -1700,8 +1702,8 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
1700 | return -ENOPROTOOPT; | 1702 | return -ENOPROTOOPT; |
1701 | if (val != 0 && val < 8) /* Avoid silly minimal values. */ | 1703 | if (val != 0 && val < 8) /* Avoid silly minimal values. */ |
1702 | val = 8; | 1704 | val = 8; |
1703 | else if (val > USHORT_MAX) | 1705 | else if (val > USHRT_MAX) |
1704 | val = USHORT_MAX; | 1706 | val = USHRT_MAX; |
1705 | up->pcrlen = val; | 1707 | up->pcrlen = val; |
1706 | up->pcflag |= UDPLITE_RECV_CC; | 1708 | up->pcflag |= UDPLITE_RECV_CC; |
1707 | break; | 1709 | break; |