diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/bluetooth/l2cap.c | 5 | ||||
| -rw-r--r-- | net/bridge/br_multicast.c | 8 | ||||
| -rw-r--r-- | net/core/dev.c | 2 | ||||
| -rw-r--r-- | net/core/rtnetlink.c | 5 | ||||
| -rw-r--r-- | net/ieee802154/af_ieee802154.c | 3 | ||||
| -rw-r--r-- | net/ipv6/af_inet6.c | 2 | ||||
| -rw-r--r-- | net/ipv6/ip6_output.c | 2 | ||||
| -rw-r--r-- | net/ipv6/route.c | 2 | ||||
| -rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 | ||||
| -rw-r--r-- | net/ipv6/xfrm6_policy.c | 2 | ||||
| -rw-r--r-- | net/mac80211/agg-tx.c | 1 | ||||
| -rw-r--r-- | net/mac80211/mlme.c | 2 | ||||
| -rw-r--r-- | net/rds/rdma_transport.c | 2 | ||||
| -rw-r--r-- | net/sctp/associola.c | 6 | ||||
| -rw-r--r-- | net/sctp/endpointola.c | 1 | ||||
| -rw-r--r-- | net/sctp/sm_make_chunk.c | 94 | ||||
| -rw-r--r-- | net/sctp/sm_sideeffect.c | 26 | ||||
| -rw-r--r-- | net/sctp/sm_statefuns.c | 8 | ||||
| -rw-r--r-- | net/sctp/socket.c | 14 | ||||
| -rw-r--r-- | net/sunrpc/auth.c | 2 | ||||
| -rw-r--r-- | net/x25/af_x25.c | 1 |
21 files changed, 142 insertions, 48 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 99d68c34e4f1..9753b690a8b3 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
| @@ -1626,7 +1626,10 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
| 1626 | /* Connectionless channel */ | 1626 | /* Connectionless channel */ |
| 1627 | if (sk->sk_type == SOCK_DGRAM) { | 1627 | if (sk->sk_type == SOCK_DGRAM) { |
| 1628 | skb = l2cap_create_connless_pdu(sk, msg, len); | 1628 | skb = l2cap_create_connless_pdu(sk, msg, len); |
| 1629 | err = l2cap_do_send(sk, skb); | 1629 | if (IS_ERR(skb)) |
| 1630 | err = PTR_ERR(skb); | ||
| 1631 | else | ||
| 1632 | err = l2cap_do_send(sk, skb); | ||
| 1630 | goto done; | 1633 | goto done; |
| 1631 | } | 1634 | } |
| 1632 | 1635 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index f29ada827a6a..eaa0e1bae49b 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -727,7 +727,7 @@ static int br_multicast_igmp3_report(struct net_bridge *br, | |||
| 727 | group = grec->grec_mca; | 727 | group = grec->grec_mca; |
| 728 | type = grec->grec_type; | 728 | type = grec->grec_type; |
| 729 | 729 | ||
| 730 | len += grec->grec_nsrcs * 4; | 730 | len += ntohs(grec->grec_nsrcs) * 4; |
| 731 | if (!pskb_may_pull(skb, len)) | 731 | if (!pskb_may_pull(skb, len)) |
| 732 | return -EINVAL; | 732 | return -EINVAL; |
| 733 | 733 | ||
| @@ -957,9 +957,6 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, | |||
| 957 | unsigned offset; | 957 | unsigned offset; |
| 958 | int err; | 958 | int err; |
| 959 | 959 | ||
| 960 | BR_INPUT_SKB_CB(skb)->igmp = 0; | ||
| 961 | BR_INPUT_SKB_CB(skb)->mrouters_only = 0; | ||
| 962 | |||
| 963 | /* We treat OOM as packet loss for now. */ | 960 | /* We treat OOM as packet loss for now. */ |
| 964 | if (!pskb_may_pull(skb, sizeof(*iph))) | 961 | if (!pskb_may_pull(skb, sizeof(*iph))) |
| 965 | return -EINVAL; | 962 | return -EINVAL; |
| @@ -1049,6 +1046,9 @@ err_out: | |||
| 1049 | int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, | 1046 | int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, |
| 1050 | struct sk_buff *skb) | 1047 | struct sk_buff *skb) |
| 1051 | { | 1048 | { |
| 1049 | BR_INPUT_SKB_CB(skb)->igmp = 0; | ||
| 1050 | BR_INPUT_SKB_CB(skb)->mrouters_only = 0; | ||
| 1051 | |||
| 1052 | if (br->multicast_disabled) | 1052 | if (br->multicast_disabled) |
| 1053 | return 0; | 1053 | return 0; |
| 1054 | 1054 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 92584bfef09b..f769098774b7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -1990,7 +1990,7 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev, | |||
| 1990 | queue_index = skb_tx_hash(dev, skb); | 1990 | queue_index = skb_tx_hash(dev, skb); |
| 1991 | 1991 | ||
| 1992 | if (sk) { | 1992 | if (sk) { |
| 1993 | struct dst_entry *dst = rcu_dereference(sk->sk_dst_cache); | 1993 | struct dst_entry *dst = rcu_dereference_bh(sk->sk_dst_cache); |
| 1994 | 1994 | ||
| 1995 | if (dst && skb_dst(skb) == dst) | 1995 | if (dst && skb_dst(skb) == dst) |
| 1996 | sk_tx_queue_set(sk, queue_index); | 1996 | sk_tx_queue_set(sk, queue_index); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 4568120d8533..fe776c9ddeca 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
| @@ -1270,10 +1270,11 @@ replay: | |||
| 1270 | err = ops->newlink(net, dev, tb, data); | 1270 | err = ops->newlink(net, dev, tb, data); |
| 1271 | else | 1271 | else |
| 1272 | err = register_netdevice(dev); | 1272 | err = register_netdevice(dev); |
| 1273 | if (err < 0 && !IS_ERR(dev)) { | 1273 | |
| 1274 | if (err < 0 && !IS_ERR(dev)) | ||
| 1274 | free_netdev(dev); | 1275 | free_netdev(dev); |
| 1276 | if (err < 0) | ||
| 1275 | goto out; | 1277 | goto out; |
| 1276 | } | ||
| 1277 | 1278 | ||
| 1278 | err = rtnl_configure_link(dev, ifm); | 1279 | err = rtnl_configure_link(dev, ifm); |
| 1279 | if (err < 0) | 1280 | if (err < 0) |
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c index c7da600750bb..93c91b633a56 100644 --- a/net/ieee802154/af_ieee802154.c +++ b/net/ieee802154/af_ieee802154.c | |||
| @@ -151,6 +151,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg, | |||
| 151 | dev_load(sock_net(sk), ifr.ifr_name); | 151 | dev_load(sock_net(sk), ifr.ifr_name); |
| 152 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); | 152 | dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); |
| 153 | 153 | ||
| 154 | if (!dev) | ||
| 155 | return -ENODEV; | ||
| 156 | |||
| 154 | if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl) | 157 | if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl) |
| 155 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); | 158 | ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); |
| 156 | 159 | ||
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 3192aa02ba5d..3f9e86b15e0d 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
| @@ -200,7 +200,7 @@ lookup_protocol: | |||
| 200 | 200 | ||
| 201 | inet_sk(sk)->pinet6 = np = inet6_sk_generic(sk); | 201 | inet_sk(sk)->pinet6 = np = inet6_sk_generic(sk); |
| 202 | np->hop_limit = -1; | 202 | np->hop_limit = -1; |
| 203 | np->mcast_hops = -1; | 203 | np->mcast_hops = IPV6_DEFAULT_MCASTHOPS; |
| 204 | np->mc_loop = 1; | 204 | np->mc_loop = 1; |
| 205 | np->pmtudisc = IPV6_PMTUDISC_WANT; | 205 | np->pmtudisc = IPV6_PMTUDISC_WANT; |
| 206 | np->ipv6only = net->ipv6.sysctl.bindv6only; | 206 | np->ipv6only = net->ipv6.sysctl.bindv6only; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 65f9c379df38..75d5ef830097 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -629,7 +629,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
| 629 | /* We must not fragment if the socket is set to force MTU discovery | 629 | /* We must not fragment if the socket is set to force MTU discovery |
| 630 | * or if the skb it not generated by a local socket. | 630 | * or if the skb it not generated by a local socket. |
| 631 | */ | 631 | */ |
| 632 | if (!skb->local_df) { | 632 | if (!skb->local_df && skb->len > mtu) { |
| 633 | skb->dev = skb_dst(skb)->dev; | 633 | skb->dev = skb_dst(skb)->dev; |
| 634 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); | 634 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
| 635 | IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), | 635 | IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c2438e8cb9d0..05ebd7833043 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -815,7 +815,7 @@ struct dst_entry * ip6_route_output(struct net *net, struct sock *sk, | |||
| 815 | { | 815 | { |
| 816 | int flags = 0; | 816 | int flags = 0; |
| 817 | 817 | ||
| 818 | if (rt6_need_strict(&fl->fl6_dst)) | 818 | if (fl->oif || rt6_need_strict(&fl->fl6_dst)) |
| 819 | flags |= RT6_LOOKUP_F_IFACE; | 819 | flags |= RT6_LOOKUP_F_IFACE; |
| 820 | 820 | ||
| 821 | if (!ipv6_addr_any(&fl->fl6_src)) | 821 | if (!ipv6_addr_any(&fl->fl6_src)) |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index c92ebe8f80d5..075f540ec197 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1015,7 +1015,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
| 1015 | skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); | 1015 | skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); |
| 1016 | 1016 | ||
| 1017 | t1 = (struct tcphdr *) skb_push(buff, tot_len); | 1017 | t1 = (struct tcphdr *) skb_push(buff, tot_len); |
| 1018 | skb_reset_transport_header(skb); | 1018 | skb_reset_transport_header(buff); |
| 1019 | 1019 | ||
| 1020 | /* Swap the send and the receive. */ | 1020 | /* Swap the send and the receive. */ |
| 1021 | memset(t1, 0, sizeof(*t1)); | 1021 | memset(t1, 0, sizeof(*t1)); |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index ae181651c75a..00bf7c962b7e 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
| @@ -124,7 +124,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
| 124 | xdst->u.dst.dev = dev; | 124 | xdst->u.dst.dev = dev; |
| 125 | dev_hold(dev); | 125 | dev_hold(dev); |
| 126 | 126 | ||
| 127 | xdst->u.rt6.rt6i_idev = in6_dev_get(rt->u.dst.dev); | 127 | xdst->u.rt6.rt6i_idev = in6_dev_get(dev); |
| 128 | if (!xdst->u.rt6.rt6i_idev) | 128 | if (!xdst->u.rt6.rt6i_idev) |
| 129 | return -ENODEV; | 129 | return -ENODEV; |
| 130 | 130 | ||
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 96d25348aa59..87782a4bb541 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
| @@ -184,7 +184,6 @@ static void sta_addba_resp_timer_expired(unsigned long data) | |||
| 184 | HT_AGG_STATE_REQ_STOP_BA_MSK)) != | 184 | HT_AGG_STATE_REQ_STOP_BA_MSK)) != |
| 185 | HT_ADDBA_REQUESTED_MSK) { | 185 | HT_ADDBA_REQUESTED_MSK) { |
| 186 | spin_unlock_bh(&sta->lock); | 186 | spin_unlock_bh(&sta->lock); |
| 187 | *state = HT_AGG_STATE_IDLE; | ||
| 188 | #ifdef CONFIG_MAC80211_HT_DEBUG | 187 | #ifdef CONFIG_MAC80211_HT_DEBUG |
| 189 | printk(KERN_DEBUG "timer expired on tid %d but we are not " | 188 | printk(KERN_DEBUG "timer expired on tid %d but we are not " |
| 190 | "(or no longer) expecting addBA response there", | 189 | "(or no longer) expecting addBA response there", |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index c8cd169fc10e..4aefa6dc3091 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -168,6 +168,8 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | |||
| 168 | ht_changed = conf_is_ht(&local->hw.conf) != enable_ht || | 168 | ht_changed = conf_is_ht(&local->hw.conf) != enable_ht || |
| 169 | channel_type != local->hw.conf.channel_type; | 169 | channel_type != local->hw.conf.channel_type; |
| 170 | 170 | ||
| 171 | if (local->tmp_channel) | ||
| 172 | local->tmp_channel_type = channel_type; | ||
| 171 | local->oper_channel_type = channel_type; | 173 | local->oper_channel_type = channel_type; |
| 172 | 174 | ||
| 173 | if (ht_changed) { | 175 | if (ht_changed) { |
diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c index 9ece910ea394..7b155081b4dc 100644 --- a/net/rds/rdma_transport.c +++ b/net/rds/rdma_transport.c | |||
| @@ -134,7 +134,7 @@ static int __init rds_rdma_listen_init(void) | |||
| 134 | ret = PTR_ERR(cm_id); | 134 | ret = PTR_ERR(cm_id); |
| 135 | printk(KERN_ERR "RDS/RDMA: failed to setup listener, " | 135 | printk(KERN_ERR "RDS/RDMA: failed to setup listener, " |
| 136 | "rdma_create_id() returned %d\n", ret); | 136 | "rdma_create_id() returned %d\n", ret); |
| 137 | goto out; | 137 | return ret; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | sin.sin_family = AF_INET, | 140 | sin.sin_family = AF_INET, |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index df5abbff63e2..99c93ee98ad9 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
| @@ -1194,8 +1194,10 @@ void sctp_assoc_update(struct sctp_association *asoc, | |||
| 1194 | /* Remove any peer addresses not present in the new association. */ | 1194 | /* Remove any peer addresses not present in the new association. */ |
| 1195 | list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { | 1195 | list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { |
| 1196 | trans = list_entry(pos, struct sctp_transport, transports); | 1196 | trans = list_entry(pos, struct sctp_transport, transports); |
| 1197 | if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) | 1197 | if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) { |
| 1198 | sctp_assoc_del_peer(asoc, &trans->ipaddr); | 1198 | sctp_assoc_rm_peer(asoc, trans); |
| 1199 | continue; | ||
| 1200 | } | ||
| 1199 | 1201 | ||
| 1200 | if (asoc->state >= SCTP_STATE_ESTABLISHED) | 1202 | if (asoc->state >= SCTP_STATE_ESTABLISHED) |
| 1201 | sctp_transport_reset(trans); | 1203 | sctp_transport_reset(trans); |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 905fda582b92..7ec09ba03a1c 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
| @@ -144,6 +144,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, | |||
| 144 | /* Use SCTP specific send buffer space queues. */ | 144 | /* Use SCTP specific send buffer space queues. */ |
| 145 | ep->sndbuf_policy = sctp_sndbuf_policy; | 145 | ep->sndbuf_policy = sctp_sndbuf_policy; |
| 146 | 146 | ||
| 147 | sk->sk_data_ready = sctp_data_ready; | ||
| 147 | sk->sk_write_space = sctp_write_space; | 148 | sk->sk_write_space = sctp_write_space; |
| 148 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); | 149 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); |
| 149 | 150 | ||
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 17cb400ecd6a..30c1767186b8 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
| @@ -108,7 +108,7 @@ static const struct sctp_paramhdr prsctp_param = { | |||
| 108 | cpu_to_be16(sizeof(struct sctp_paramhdr)), | 108 | cpu_to_be16(sizeof(struct sctp_paramhdr)), |
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | /* A helper to initialize to initialize an op error inside a | 111 | /* A helper to initialize an op error inside a |
| 112 | * provided chunk, as most cause codes will be embedded inside an | 112 | * provided chunk, as most cause codes will be embedded inside an |
| 113 | * abort chunk. | 113 | * abort chunk. |
| 114 | */ | 114 | */ |
| @@ -125,6 +125,29 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, | |||
| 125 | chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); | 125 | chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /* A helper to initialize an op error inside a | ||
| 129 | * provided chunk, as most cause codes will be embedded inside an | ||
| 130 | * abort chunk. Differs from sctp_init_cause in that it won't oops | ||
| 131 | * if there isn't enough space in the op error chunk | ||
| 132 | */ | ||
| 133 | int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code, | ||
| 134 | size_t paylen) | ||
| 135 | { | ||
| 136 | sctp_errhdr_t err; | ||
| 137 | __u16 len; | ||
| 138 | |||
| 139 | /* Cause code constants are now defined in network order. */ | ||
| 140 | err.cause = cause_code; | ||
| 141 | len = sizeof(sctp_errhdr_t) + paylen; | ||
| 142 | err.length = htons(len); | ||
| 143 | |||
| 144 | if (skb_tailroom(chunk->skb) > len) | ||
| 145 | return -ENOSPC; | ||
| 146 | chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk, | ||
| 147 | sizeof(sctp_errhdr_t), | ||
| 148 | &err); | ||
| 149 | return 0; | ||
| 150 | } | ||
| 128 | /* 3.3.2 Initiation (INIT) (1) | 151 | /* 3.3.2 Initiation (INIT) (1) |
| 129 | * | 152 | * |
| 130 | * This chunk is used to initiate a SCTP association between two | 153 | * This chunk is used to initiate a SCTP association between two |
| @@ -208,7 +231,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
| 208 | sp = sctp_sk(asoc->base.sk); | 231 | sp = sctp_sk(asoc->base.sk); |
| 209 | num_types = sp->pf->supported_addrs(sp, types); | 232 | num_types = sp->pf->supported_addrs(sp, types); |
| 210 | 233 | ||
| 211 | chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); | 234 | chunksize = sizeof(init) + addrs_len; |
| 235 | chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types)); | ||
| 212 | chunksize += sizeof(ecap_param); | 236 | chunksize += sizeof(ecap_param); |
| 213 | 237 | ||
| 214 | if (sctp_prsctp_enable) | 238 | if (sctp_prsctp_enable) |
| @@ -238,14 +262,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
| 238 | /* Add HMACS parameter length if any were defined */ | 262 | /* Add HMACS parameter length if any were defined */ |
| 239 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; | 263 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; |
| 240 | if (auth_hmacs->length) | 264 | if (auth_hmacs->length) |
| 241 | chunksize += ntohs(auth_hmacs->length); | 265 | chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); |
| 242 | else | 266 | else |
| 243 | auth_hmacs = NULL; | 267 | auth_hmacs = NULL; |
| 244 | 268 | ||
| 245 | /* Add CHUNKS parameter length */ | 269 | /* Add CHUNKS parameter length */ |
| 246 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; | 270 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; |
| 247 | if (auth_chunks->length) | 271 | if (auth_chunks->length) |
| 248 | chunksize += ntohs(auth_chunks->length); | 272 | chunksize += WORD_ROUND(ntohs(auth_chunks->length)); |
| 249 | else | 273 | else |
| 250 | auth_chunks = NULL; | 274 | auth_chunks = NULL; |
| 251 | 275 | ||
| @@ -255,7 +279,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, | |||
| 255 | 279 | ||
| 256 | /* If we have any extensions to report, account for that */ | 280 | /* If we have any extensions to report, account for that */ |
| 257 | if (num_ext) | 281 | if (num_ext) |
| 258 | chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; | 282 | chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + |
| 283 | num_ext); | ||
| 259 | 284 | ||
| 260 | /* RFC 2960 3.3.2 Initiation (INIT) (1) | 285 | /* RFC 2960 3.3.2 Initiation (INIT) (1) |
| 261 | * | 286 | * |
| @@ -397,13 +422,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
| 397 | 422 | ||
| 398 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; | 423 | auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; |
| 399 | if (auth_hmacs->length) | 424 | if (auth_hmacs->length) |
| 400 | chunksize += ntohs(auth_hmacs->length); | 425 | chunksize += WORD_ROUND(ntohs(auth_hmacs->length)); |
| 401 | else | 426 | else |
| 402 | auth_hmacs = NULL; | 427 | auth_hmacs = NULL; |
| 403 | 428 | ||
| 404 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; | 429 | auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; |
| 405 | if (auth_chunks->length) | 430 | if (auth_chunks->length) |
| 406 | chunksize += ntohs(auth_chunks->length); | 431 | chunksize += WORD_ROUND(ntohs(auth_chunks->length)); |
| 407 | else | 432 | else |
| 408 | auth_chunks = NULL; | 433 | auth_chunks = NULL; |
| 409 | 434 | ||
| @@ -412,7 +437,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc, | |||
| 412 | } | 437 | } |
| 413 | 438 | ||
| 414 | if (num_ext) | 439 | if (num_ext) |
| 415 | chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; | 440 | chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) + |
| 441 | num_ext); | ||
| 416 | 442 | ||
| 417 | /* Now allocate and fill out the chunk. */ | 443 | /* Now allocate and fill out the chunk. */ |
| 418 | retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); | 444 | retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); |
| @@ -1129,6 +1155,24 @@ nodata: | |||
| 1129 | return retval; | 1155 | return retval; |
| 1130 | } | 1156 | } |
| 1131 | 1157 | ||
| 1158 | /* Create an Operation Error chunk of a fixed size, | ||
| 1159 | * specifically, max(asoc->pathmtu, SCTP_DEFAULT_MAXSEGMENT) | ||
| 1160 | * This is a helper function to allocate an error chunk for | ||
| 1161 | * for those invalid parameter codes in which we may not want | ||
| 1162 | * to report all the errors, if the incomming chunk is large | ||
| 1163 | */ | ||
| 1164 | static inline struct sctp_chunk *sctp_make_op_error_fixed( | ||
| 1165 | const struct sctp_association *asoc, | ||
| 1166 | const struct sctp_chunk *chunk) | ||
| 1167 | { | ||
| 1168 | size_t size = asoc ? asoc->pathmtu : 0; | ||
| 1169 | |||
| 1170 | if (!size) | ||
| 1171 | size = SCTP_DEFAULT_MAXSEGMENT; | ||
| 1172 | |||
| 1173 | return sctp_make_op_error_space(asoc, chunk, size); | ||
| 1174 | } | ||
| 1175 | |||
| 1132 | /* Create an Operation Error chunk. */ | 1176 | /* Create an Operation Error chunk. */ |
| 1133 | struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc, | 1177 | struct sctp_chunk *sctp_make_op_error(const struct sctp_association *asoc, |
| 1134 | const struct sctp_chunk *chunk, | 1178 | const struct sctp_chunk *chunk, |
| @@ -1371,6 +1415,18 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) | |||
| 1371 | return target; | 1415 | return target; |
| 1372 | } | 1416 | } |
| 1373 | 1417 | ||
| 1418 | /* Append bytes to the end of a chunk. Returns NULL if there isn't sufficient | ||
| 1419 | * space in the chunk | ||
| 1420 | */ | ||
| 1421 | void *sctp_addto_chunk_fixed(struct sctp_chunk *chunk, | ||
| 1422 | int len, const void *data) | ||
| 1423 | { | ||
| 1424 | if (skb_tailroom(chunk->skb) > len) | ||
| 1425 | return sctp_addto_chunk(chunk, len, data); | ||
| 1426 | else | ||
| 1427 | return NULL; | ||
| 1428 | } | ||
| 1429 | |||
| 1374 | /* Append bytes from user space to the end of a chunk. Will panic if | 1430 | /* Append bytes from user space to the end of a chunk. Will panic if |
| 1375 | * chunk is not big enough. | 1431 | * chunk is not big enough. |
| 1376 | * Returns a kernel err value. | 1432 | * Returns a kernel err value. |
| @@ -1974,13 +2030,12 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, | |||
| 1974 | * returning multiple unknown parameters. | 2030 | * returning multiple unknown parameters. |
| 1975 | */ | 2031 | */ |
| 1976 | if (NULL == *errp) | 2032 | if (NULL == *errp) |
| 1977 | *errp = sctp_make_op_error_space(asoc, chunk, | 2033 | *errp = sctp_make_op_error_fixed(asoc, chunk); |
| 1978 | ntohs(chunk->chunk_hdr->length)); | ||
| 1979 | 2034 | ||
| 1980 | if (*errp) { | 2035 | if (*errp) { |
| 1981 | sctp_init_cause(*errp, SCTP_ERROR_UNKNOWN_PARAM, | 2036 | sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM, |
| 1982 | WORD_ROUND(ntohs(param.p->length))); | 2037 | WORD_ROUND(ntohs(param.p->length))); |
| 1983 | sctp_addto_chunk(*errp, | 2038 | sctp_addto_chunk_fixed(*errp, |
| 1984 | WORD_ROUND(ntohs(param.p->length)), | 2039 | WORD_ROUND(ntohs(param.p->length)), |
| 1985 | param.v); | 2040 | param.v); |
| 1986 | } else { | 2041 | } else { |
| @@ -3315,21 +3370,6 @@ int sctp_process_asconf_ack(struct sctp_association *asoc, | |||
| 3315 | sctp_chunk_free(asconf); | 3370 | sctp_chunk_free(asconf); |
| 3316 | asoc->addip_last_asconf = NULL; | 3371 | asoc->addip_last_asconf = NULL; |
| 3317 | 3372 | ||
| 3318 | /* Send the next asconf chunk from the addip chunk queue. */ | ||
| 3319 | if (!list_empty(&asoc->addip_chunk_list)) { | ||
| 3320 | struct list_head *entry = asoc->addip_chunk_list.next; | ||
| 3321 | asconf = list_entry(entry, struct sctp_chunk, list); | ||
| 3322 | |||
| 3323 | list_del_init(entry); | ||
| 3324 | |||
| 3325 | /* Hold the chunk until an ASCONF_ACK is received. */ | ||
| 3326 | sctp_chunk_hold(asconf); | ||
| 3327 | if (sctp_primitive_ASCONF(asoc, asconf)) | ||
| 3328 | sctp_chunk_free(asconf); | ||
| 3329 | else | ||
| 3330 | asoc->addip_last_asconf = asconf; | ||
| 3331 | } | ||
| 3332 | |||
| 3333 | return retval; | 3373 | return retval; |
| 3334 | } | 3374 | } |
| 3335 | 3375 | ||
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 4c5bed9af4e3..d5ae450b6f02 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
| @@ -962,6 +962,29 @@ static int sctp_cmd_send_msg(struct sctp_association *asoc, | |||
| 962 | } | 962 | } |
| 963 | 963 | ||
| 964 | 964 | ||
| 965 | /* Sent the next ASCONF packet currently stored in the association. | ||
| 966 | * This happens after the ASCONF_ACK was succeffully processed. | ||
| 967 | */ | ||
| 968 | static void sctp_cmd_send_asconf(struct sctp_association *asoc) | ||
| 969 | { | ||
| 970 | /* Send the next asconf chunk from the addip chunk | ||
| 971 | * queue. | ||
| 972 | */ | ||
| 973 | if (!list_empty(&asoc->addip_chunk_list)) { | ||
| 974 | struct list_head *entry = asoc->addip_chunk_list.next; | ||
| 975 | struct sctp_chunk *asconf = list_entry(entry, | ||
| 976 | struct sctp_chunk, list); | ||
| 977 | list_del_init(entry); | ||
| 978 | |||
| 979 | /* Hold the chunk until an ASCONF_ACK is received. */ | ||
| 980 | sctp_chunk_hold(asconf); | ||
| 981 | if (sctp_primitive_ASCONF(asoc, asconf)) | ||
| 982 | sctp_chunk_free(asconf); | ||
| 983 | else | ||
| 984 | asoc->addip_last_asconf = asconf; | ||
| 985 | } | ||
| 986 | } | ||
| 987 | |||
| 965 | 988 | ||
| 966 | /* These three macros allow us to pull the debugging code out of the | 989 | /* These three macros allow us to pull the debugging code out of the |
| 967 | * main flow of sctp_do_sm() to keep attention focused on the real | 990 | * main flow of sctp_do_sm() to keep attention focused on the real |
| @@ -1617,6 +1640,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
| 1617 | } | 1640 | } |
| 1618 | error = sctp_cmd_send_msg(asoc, cmd->obj.msg); | 1641 | error = sctp_cmd_send_msg(asoc, cmd->obj.msg); |
| 1619 | break; | 1642 | break; |
| 1643 | case SCTP_CMD_SEND_NEXT_ASCONF: | ||
| 1644 | sctp_cmd_send_asconf(asoc); | ||
| 1645 | break; | ||
| 1620 | default: | 1646 | default: |
| 1621 | printk(KERN_WARNING "Impossible command: %u, %p\n", | 1647 | printk(KERN_WARNING "Impossible command: %u, %p\n", |
| 1622 | cmd->verb, cmd->obj.ptr); | 1648 | cmd->verb, cmd->obj.ptr); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index abf601a1b847..24b2cd555637 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
| @@ -3676,8 +3676,14 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep, | |||
| 3676 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); | 3676 | SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO)); |
| 3677 | 3677 | ||
| 3678 | if (!sctp_process_asconf_ack((struct sctp_association *)asoc, | 3678 | if (!sctp_process_asconf_ack((struct sctp_association *)asoc, |
| 3679 | asconf_ack)) | 3679 | asconf_ack)) { |
| 3680 | /* Successfully processed ASCONF_ACK. We can | ||
| 3681 | * release the next asconf if we have one. | ||
| 3682 | */ | ||
| 3683 | sctp_add_cmd_sf(commands, SCTP_CMD_SEND_NEXT_ASCONF, | ||
| 3684 | SCTP_NULL()); | ||
| 3680 | return SCTP_DISPOSITION_CONSUME; | 3685 | return SCTP_DISPOSITION_CONSUME; |
| 3686 | } | ||
| 3681 | 3687 | ||
| 3682 | abort = sctp_make_abort(asoc, asconf_ack, | 3688 | abort = sctp_make_abort(asoc, asconf_ack, |
| 3683 | sizeof(sctp_errhdr_t)); | 3689 | sizeof(sctp_errhdr_t)); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 007e8baba089..44a1ab03a3f0 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
| @@ -3719,12 +3719,12 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) | |||
| 3719 | sp->hmac = NULL; | 3719 | sp->hmac = NULL; |
| 3720 | 3720 | ||
| 3721 | SCTP_DBG_OBJCNT_INC(sock); | 3721 | SCTP_DBG_OBJCNT_INC(sock); |
| 3722 | percpu_counter_inc(&sctp_sockets_allocated); | ||
| 3723 | 3722 | ||
| 3724 | /* Set socket backlog limit. */ | 3723 | /* Set socket backlog limit. */ |
| 3725 | sk->sk_backlog.limit = sysctl_sctp_rmem[1]; | 3724 | sk->sk_backlog.limit = sysctl_sctp_rmem[1]; |
| 3726 | 3725 | ||
| 3727 | local_bh_disable(); | 3726 | local_bh_disable(); |
| 3727 | percpu_counter_inc(&sctp_sockets_allocated); | ||
| 3728 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | 3728 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
| 3729 | local_bh_enable(); | 3729 | local_bh_enable(); |
| 3730 | 3730 | ||
| @@ -3741,8 +3741,8 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk) | |||
| 3741 | /* Release our hold on the endpoint. */ | 3741 | /* Release our hold on the endpoint. */ |
| 3742 | ep = sctp_sk(sk)->ep; | 3742 | ep = sctp_sk(sk)->ep; |
| 3743 | sctp_endpoint_free(ep); | 3743 | sctp_endpoint_free(ep); |
| 3744 | percpu_counter_dec(&sctp_sockets_allocated); | ||
| 3745 | local_bh_disable(); | 3744 | local_bh_disable(); |
| 3745 | percpu_counter_dec(&sctp_sockets_allocated); | ||
| 3746 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); | 3746 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); |
| 3747 | local_bh_enable(); | 3747 | local_bh_enable(); |
| 3748 | } | 3748 | } |
| @@ -6189,6 +6189,16 @@ do_nonblock: | |||
| 6189 | goto out; | 6189 | goto out; |
| 6190 | } | 6190 | } |
| 6191 | 6191 | ||
| 6192 | void sctp_data_ready(struct sock *sk, int len) | ||
| 6193 | { | ||
| 6194 | read_lock_bh(&sk->sk_callback_lock); | ||
| 6195 | if (sk_has_sleeper(sk)) | ||
| 6196 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN | | ||
| 6197 | POLLRDNORM | POLLRDBAND); | ||
| 6198 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); | ||
| 6199 | read_unlock_bh(&sk->sk_callback_lock); | ||
| 6200 | } | ||
| 6201 | |||
| 6192 | /* If socket sndbuf has changed, wake up all per association waiters. */ | 6202 | /* If socket sndbuf has changed, wake up all per association waiters. */ |
| 6193 | void sctp_write_space(struct sock *sk) | 6203 | void sctp_write_space(struct sock *sk) |
| 6194 | { | 6204 | { |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index f394fc190a49..95afe79dd9d7 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
| @@ -237,7 +237,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan) | |||
| 237 | list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { | 237 | list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) { |
| 238 | 238 | ||
| 239 | /* Enforce a 60 second garbage collection moratorium */ | 239 | /* Enforce a 60 second garbage collection moratorium */ |
| 240 | if (time_in_range_open(cred->cr_expire, expired, jiffies) && | 240 | if (time_in_range(cred->cr_expire, expired, jiffies) && |
| 241 | test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) | 241 | test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0) |
| 242 | continue; | 242 | continue; |
| 243 | 243 | ||
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index cbddd0cb83f1..36e84e13c6aa 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
| @@ -402,6 +402,7 @@ static void __x25_destroy_socket(struct sock *sk) | |||
| 402 | /* | 402 | /* |
| 403 | * Queue the unaccepted socket for death | 403 | * Queue the unaccepted socket for death |
| 404 | */ | 404 | */ |
| 405 | skb->sk->sk_state = TCP_LISTEN; | ||
| 405 | sock_set_flag(skb->sk, SOCK_DEAD); | 406 | sock_set_flag(skb->sk, SOCK_DEAD); |
| 406 | x25_start_heartbeat(skb->sk); | 407 | x25_start_heartbeat(skb->sk); |
| 407 | x25_sk(skb->sk)->state = X25_STATE_0; | 408 | x25_sk(skb->sk)->state = X25_STATE_0; |
