diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/atm/atm_sysfs.c | 40 | ||||
| -rw-r--r-- | net/bridge/br_mdb.c | 22 | ||||
| -rw-r--r-- | net/bridge/br_multicast.c | 13 | ||||
| -rw-r--r-- | net/bridge/br_netlink.c | 1 | ||||
| -rw-r--r-- | net/bridge/br_private.h | 5 | ||||
| -rw-r--r-- | net/dccp/ipv4.c | 4 | ||||
| -rw-r--r-- | net/dccp/ipv6.c | 3 | ||||
| -rw-r--r-- | net/ipv4/inet_connection_sock.c | 16 | ||||
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 | ||||
| -rw-r--r-- | net/ipv6/Makefile | 2 | ||||
| -rw-r--r-- | net/ipv6/addrconf.c | 3 | ||||
| -rw-r--r-- | net/ipv6/ndisc.c | 17 | ||||
| -rw-r--r-- | net/ipv6/tcp_ipv6.c | 3 | ||||
| -rw-r--r-- | net/mac802154/ieee802154_dev.c | 4 | ||||
| -rw-r--r-- | net/netlink/af_netlink.c | 5 | ||||
| -rw-r--r-- | net/sctp/Kconfig | 27 | ||||
| -rw-r--r-- | net/sctp/probe.c | 3 | ||||
| -rw-r--r-- | net/sctp/protocol.c | 4 |
18 files changed, 121 insertions, 57 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index f49da5814bc3..350bf62b2ae3 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
| @@ -14,49 +14,45 @@ static ssize_t show_type(struct device *cdev, | |||
| 14 | struct device_attribute *attr, char *buf) | 14 | struct device_attribute *attr, char *buf) |
| 15 | { | 15 | { |
| 16 | struct atm_dev *adev = to_atm_dev(cdev); | 16 | struct atm_dev *adev = to_atm_dev(cdev); |
| 17 | return sprintf(buf, "%s\n", adev->type); | 17 | |
| 18 | return scnprintf(buf, PAGE_SIZE, "%s\n", adev->type); | ||
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | static ssize_t show_address(struct device *cdev, | 21 | static ssize_t show_address(struct device *cdev, |
| 21 | struct device_attribute *attr, char *buf) | 22 | struct device_attribute *attr, char *buf) |
| 22 | { | 23 | { |
| 23 | char *pos = buf; | ||
| 24 | struct atm_dev *adev = to_atm_dev(cdev); | 24 | struct atm_dev *adev = to_atm_dev(cdev); |
| 25 | int i; | ||
| 26 | |||
| 27 | for (i = 0; i < (ESI_LEN - 1); i++) | ||
| 28 | pos += sprintf(pos, "%02x:", adev->esi[i]); | ||
| 29 | pos += sprintf(pos, "%02x\n", adev->esi[i]); | ||
| 30 | 25 | ||
| 31 | return pos - buf; | 26 | return scnprintf(buf, PAGE_SIZE, "%pM\n", adev->esi); |
| 32 | } | 27 | } |
| 33 | 28 | ||
| 34 | static ssize_t show_atmaddress(struct device *cdev, | 29 | static ssize_t show_atmaddress(struct device *cdev, |
| 35 | struct device_attribute *attr, char *buf) | 30 | struct device_attribute *attr, char *buf) |
| 36 | { | 31 | { |
| 37 | unsigned long flags; | 32 | unsigned long flags; |
| 38 | char *pos = buf; | ||
| 39 | struct atm_dev *adev = to_atm_dev(cdev); | 33 | struct atm_dev *adev = to_atm_dev(cdev); |
| 40 | struct atm_dev_addr *aaddr; | 34 | struct atm_dev_addr *aaddr; |
| 41 | int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin; | 35 | int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin; |
| 42 | int i, j; | 36 | int i, j, count = 0; |
| 43 | 37 | ||
| 44 | spin_lock_irqsave(&adev->lock, flags); | 38 | spin_lock_irqsave(&adev->lock, flags); |
| 45 | list_for_each_entry(aaddr, &adev->local, entry) { | 39 | list_for_each_entry(aaddr, &adev->local, entry) { |
| 46 | for (i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) { | 40 | for (i = 0, j = 0; i < ATM_ESA_LEN; ++i, ++j) { |
| 47 | if (j == *fmt) { | 41 | if (j == *fmt) { |
| 48 | pos += sprintf(pos, "."); | 42 | count += scnprintf(buf + count, |
| 43 | PAGE_SIZE - count, "."); | ||
| 49 | ++fmt; | 44 | ++fmt; |
| 50 | j = 0; | 45 | j = 0; |
| 51 | } | 46 | } |
| 52 | pos += sprintf(pos, "%02x", | 47 | count += scnprintf(buf + count, |
| 53 | aaddr->addr.sas_addr.prv[i]); | 48 | PAGE_SIZE - count, "%02x", |
| 49 | aaddr->addr.sas_addr.prv[i]); | ||
| 54 | } | 50 | } |
| 55 | pos += sprintf(pos, "\n"); | 51 | count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); |
| 56 | } | 52 | } |
| 57 | spin_unlock_irqrestore(&adev->lock, flags); | 53 | spin_unlock_irqrestore(&adev->lock, flags); |
| 58 | 54 | ||
| 59 | return pos - buf; | 55 | return count; |
| 60 | } | 56 | } |
| 61 | 57 | ||
| 62 | static ssize_t show_atmindex(struct device *cdev, | 58 | static ssize_t show_atmindex(struct device *cdev, |
| @@ -64,25 +60,21 @@ static ssize_t show_atmindex(struct device *cdev, | |||
| 64 | { | 60 | { |
| 65 | struct atm_dev *adev = to_atm_dev(cdev); | 61 | struct atm_dev *adev = to_atm_dev(cdev); |
| 66 | 62 | ||
| 67 | return sprintf(buf, "%d\n", adev->number); | 63 | return scnprintf(buf, PAGE_SIZE, "%d\n", adev->number); |
| 68 | } | 64 | } |
| 69 | 65 | ||
| 70 | static ssize_t show_carrier(struct device *cdev, | 66 | static ssize_t show_carrier(struct device *cdev, |
| 71 | struct device_attribute *attr, char *buf) | 67 | struct device_attribute *attr, char *buf) |
| 72 | { | 68 | { |
| 73 | char *pos = buf; | ||
| 74 | struct atm_dev *adev = to_atm_dev(cdev); | 69 | struct atm_dev *adev = to_atm_dev(cdev); |
| 75 | 70 | ||
| 76 | pos += sprintf(pos, "%d\n", | 71 | return scnprintf(buf, PAGE_SIZE, "%d\n", |
| 77 | adev->signal == ATM_PHY_SIG_LOST ? 0 : 1); | 72 | adev->signal == ATM_PHY_SIG_LOST ? 0 : 1); |
| 78 | |||
| 79 | return pos - buf; | ||
| 80 | } | 73 | } |
| 81 | 74 | ||
| 82 | static ssize_t show_link_rate(struct device *cdev, | 75 | static ssize_t show_link_rate(struct device *cdev, |
| 83 | struct device_attribute *attr, char *buf) | 76 | struct device_attribute *attr, char *buf) |
| 84 | { | 77 | { |
| 85 | char *pos = buf; | ||
| 86 | struct atm_dev *adev = to_atm_dev(cdev); | 78 | struct atm_dev *adev = to_atm_dev(cdev); |
| 87 | int link_rate; | 79 | int link_rate; |
| 88 | 80 | ||
| @@ -100,9 +92,7 @@ static ssize_t show_link_rate(struct device *cdev, | |||
| 100 | default: | 92 | default: |
| 101 | link_rate = adev->link_rate * 8 * 53; | 93 | link_rate = adev->link_rate * 8 * 53; |
| 102 | } | 94 | } |
| 103 | pos += sprintf(pos, "%d\n", link_rate); | 95 | return scnprintf(buf, PAGE_SIZE, "%d\n", link_rate); |
| 104 | |||
| 105 | return pos - buf; | ||
| 106 | } | 96 | } |
| 107 | 97 | ||
| 108 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); | 98 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); |
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 6f0a2eebcb27..acc9f4cc18f7 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c | |||
| @@ -83,9 +83,12 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, | |||
| 83 | if (port) { | 83 | if (port) { |
| 84 | struct br_mdb_entry e; | 84 | struct br_mdb_entry e; |
| 85 | e.ifindex = port->dev->ifindex; | 85 | e.ifindex = port->dev->ifindex; |
| 86 | e.addr.u.ip4 = p->addr.u.ip4; | 86 | e.state = p->state; |
| 87 | if (p->addr.proto == htons(ETH_P_IP)) | ||
| 88 | e.addr.u.ip4 = p->addr.u.ip4; | ||
| 87 | #if IS_ENABLED(CONFIG_IPV6) | 89 | #if IS_ENABLED(CONFIG_IPV6) |
| 88 | e.addr.u.ip6 = p->addr.u.ip6; | 90 | if (p->addr.proto == htons(ETH_P_IPV6)) |
| 91 | e.addr.u.ip6 = p->addr.u.ip6; | ||
| 89 | #endif | 92 | #endif |
| 90 | e.addr.proto = p->addr.proto; | 93 | e.addr.proto = p->addr.proto; |
| 91 | if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(e), &e)) { | 94 | if (nla_put(skb, MDBA_MDB_ENTRY_INFO, sizeof(e), &e)) { |
| @@ -253,6 +256,8 @@ static bool is_valid_mdb_entry(struct br_mdb_entry *entry) | |||
| 253 | #endif | 256 | #endif |
| 254 | } else | 257 | } else |
| 255 | return false; | 258 | return false; |
| 259 | if (entry->state != MDB_PERMANENT && entry->state != MDB_TEMPORARY) | ||
| 260 | return false; | ||
| 256 | 261 | ||
| 257 | return true; | 262 | return true; |
| 258 | } | 263 | } |
| @@ -310,7 +315,7 @@ static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
| 310 | } | 315 | } |
| 311 | 316 | ||
| 312 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, | 317 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, |
| 313 | struct br_ip *group) | 318 | struct br_ip *group, unsigned char state) |
| 314 | { | 319 | { |
| 315 | struct net_bridge_mdb_entry *mp; | 320 | struct net_bridge_mdb_entry *mp; |
| 316 | struct net_bridge_port_group *p; | 321 | struct net_bridge_port_group *p; |
| @@ -336,7 +341,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, | |||
| 336 | break; | 341 | break; |
| 337 | } | 342 | } |
| 338 | 343 | ||
| 339 | p = br_multicast_new_port_group(port, group, *pp); | 344 | p = br_multicast_new_port_group(port, group, *pp, state); |
| 340 | if (unlikely(!p)) | 345 | if (unlikely(!p)) |
| 341 | return -ENOMEM; | 346 | return -ENOMEM; |
| 342 | rcu_assign_pointer(*pp, p); | 347 | rcu_assign_pointer(*pp, p); |
| @@ -373,7 +378,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, | |||
| 373 | #endif | 378 | #endif |
| 374 | 379 | ||
| 375 | spin_lock_bh(&br->multicast_lock); | 380 | spin_lock_bh(&br->multicast_lock); |
| 376 | ret = br_mdb_add_group(br, p, &ip); | 381 | ret = br_mdb_add_group(br, p, &ip, entry->state); |
| 377 | spin_unlock_bh(&br->multicast_lock); | 382 | spin_unlock_bh(&br->multicast_lock); |
| 378 | return ret; | 383 | return ret; |
| 379 | } | 384 | } |
| @@ -479,3 +484,10 @@ void br_mdb_init(void) | |||
| 479 | rtnl_register(PF_BRIDGE, RTM_NEWMDB, br_mdb_add, NULL, NULL); | 484 | rtnl_register(PF_BRIDGE, RTM_NEWMDB, br_mdb_add, NULL, NULL); |
| 480 | rtnl_register(PF_BRIDGE, RTM_DELMDB, br_mdb_del, NULL, NULL); | 485 | rtnl_register(PF_BRIDGE, RTM_DELMDB, br_mdb_del, NULL, NULL); |
| 481 | } | 486 | } |
| 487 | |||
| 488 | void br_mdb_uninit(void) | ||
| 489 | { | ||
| 490 | rtnl_unregister(PF_BRIDGE, RTM_GETMDB); | ||
| 491 | rtnl_unregister(PF_BRIDGE, RTM_NEWMDB); | ||
| 492 | rtnl_unregister(PF_BRIDGE, RTM_DELMDB); | ||
| 493 | } | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 1093c89095d8..5391ca43336a 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -279,7 +279,7 @@ static void br_multicast_port_group_expired(unsigned long data) | |||
| 279 | 279 | ||
| 280 | spin_lock(&br->multicast_lock); | 280 | spin_lock(&br->multicast_lock); |
| 281 | if (!netif_running(br->dev) || timer_pending(&pg->timer) || | 281 | if (!netif_running(br->dev) || timer_pending(&pg->timer) || |
| 282 | hlist_unhashed(&pg->mglist)) | 282 | hlist_unhashed(&pg->mglist) || pg->state & MDB_PERMANENT) |
| 283 | goto out; | 283 | goto out; |
| 284 | 284 | ||
| 285 | br_multicast_del_pg(br, pg); | 285 | br_multicast_del_pg(br, pg); |
| @@ -622,7 +622,8 @@ out: | |||
| 622 | struct net_bridge_port_group *br_multicast_new_port_group( | 622 | struct net_bridge_port_group *br_multicast_new_port_group( |
| 623 | struct net_bridge_port *port, | 623 | struct net_bridge_port *port, |
| 624 | struct br_ip *group, | 624 | struct br_ip *group, |
| 625 | struct net_bridge_port_group __rcu *next) | 625 | struct net_bridge_port_group __rcu *next, |
| 626 | unsigned char state) | ||
| 626 | { | 627 | { |
| 627 | struct net_bridge_port_group *p; | 628 | struct net_bridge_port_group *p; |
| 628 | 629 | ||
| @@ -632,6 +633,7 @@ struct net_bridge_port_group *br_multicast_new_port_group( | |||
| 632 | 633 | ||
| 633 | p->addr = *group; | 634 | p->addr = *group; |
| 634 | p->port = port; | 635 | p->port = port; |
| 636 | p->state = state; | ||
| 635 | rcu_assign_pointer(p->next, next); | 637 | rcu_assign_pointer(p->next, next); |
| 636 | hlist_add_head(&p->mglist, &port->mglist); | 638 | hlist_add_head(&p->mglist, &port->mglist); |
| 637 | setup_timer(&p->timer, br_multicast_port_group_expired, | 639 | setup_timer(&p->timer, br_multicast_port_group_expired, |
| @@ -674,7 +676,7 @@ static int br_multicast_add_group(struct net_bridge *br, | |||
| 674 | break; | 676 | break; |
| 675 | } | 677 | } |
| 676 | 678 | ||
| 677 | p = br_multicast_new_port_group(port, group, *pp); | 679 | p = br_multicast_new_port_group(port, group, *pp, MDB_TEMPORARY); |
| 678 | if (unlikely(!p)) | 680 | if (unlikely(!p)) |
| 679 | goto err; | 681 | goto err; |
| 680 | rcu_assign_pointer(*pp, p); | 682 | rcu_assign_pointer(*pp, p); |
| @@ -1165,7 +1167,6 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
| 1165 | if (max_delay) | 1167 | if (max_delay) |
| 1166 | group = &mld->mld_mca; | 1168 | group = &mld->mld_mca; |
| 1167 | } else if (skb->len >= sizeof(*mld2q)) { | 1169 | } else if (skb->len >= sizeof(*mld2q)) { |
| 1168 | u16 mrc; | ||
| 1169 | if (!pskb_may_pull(skb, sizeof(*mld2q))) { | 1170 | if (!pskb_may_pull(skb, sizeof(*mld2q))) { |
| 1170 | err = -EINVAL; | 1171 | err = -EINVAL; |
| 1171 | goto out; | 1172 | goto out; |
| @@ -1173,8 +1174,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
| 1173 | mld2q = (struct mld2_query *)icmp6_hdr(skb); | 1174 | mld2q = (struct mld2_query *)icmp6_hdr(skb); |
| 1174 | if (!mld2q->mld2q_nsrcs) | 1175 | if (!mld2q->mld2q_nsrcs) |
| 1175 | group = &mld2q->mld2q_mca; | 1176 | group = &mld2q->mld2q_mca; |
| 1176 | mrc = ntohs(mld2q->mld2q_mrc); | 1177 | max_delay = mld2q->mld2q_mrc ? MLDV2_MRC(ntohs(mld2q->mld2q_mrc)) : 1; |
| 1177 | max_delay = mrc ? MLDV2_MRC(mrc) : 1; | ||
| 1178 | } | 1178 | } |
| 1179 | 1179 | ||
| 1180 | if (!group) | 1180 | if (!group) |
| @@ -1633,6 +1633,7 @@ void br_multicast_stop(struct net_bridge *br) | |||
| 1633 | del_timer_sync(&br->multicast_querier_timer); | 1633 | del_timer_sync(&br->multicast_querier_timer); |
| 1634 | del_timer_sync(&br->multicast_query_timer); | 1634 | del_timer_sync(&br->multicast_query_timer); |
| 1635 | 1635 | ||
| 1636 | br_mdb_uninit(); | ||
| 1636 | spin_lock_bh(&br->multicast_lock); | 1637 | spin_lock_bh(&br->multicast_lock); |
| 1637 | mdb = mlock_dereference(br->mdb, br); | 1638 | mdb = mlock_dereference(br->mdb, br); |
| 1638 | if (!mdb) | 1639 | if (!mdb) |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index dead9dfe865b..97ba0189c6f7 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
| @@ -305,5 +305,4 @@ int __init br_netlink_init(void) | |||
| 305 | void __exit br_netlink_fini(void) | 305 | void __exit br_netlink_fini(void) |
| 306 | { | 306 | { |
| 307 | rtnl_link_unregister(&br_link_ops); | 307 | rtnl_link_unregister(&br_link_ops); |
| 308 | rtnl_unregister_all(PF_BRIDGE); | ||
| 309 | } | 308 | } |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index f21a739a6186..8d83be5ffedc 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
| @@ -83,6 +83,7 @@ struct net_bridge_port_group { | |||
| 83 | struct rcu_head rcu; | 83 | struct rcu_head rcu; |
| 84 | struct timer_list timer; | 84 | struct timer_list timer; |
| 85 | struct br_ip addr; | 85 | struct br_ip addr; |
| 86 | unsigned char state; | ||
| 86 | }; | 87 | }; |
| 87 | 88 | ||
| 88 | struct net_bridge_mdb_entry | 89 | struct net_bridge_mdb_entry |
| @@ -443,8 +444,10 @@ extern void br_multicast_free_pg(struct rcu_head *head); | |||
| 443 | extern struct net_bridge_port_group *br_multicast_new_port_group( | 444 | extern struct net_bridge_port_group *br_multicast_new_port_group( |
| 444 | struct net_bridge_port *port, | 445 | struct net_bridge_port *port, |
| 445 | struct br_ip *group, | 446 | struct br_ip *group, |
| 446 | struct net_bridge_port_group *next); | 447 | struct net_bridge_port_group *next, |
| 448 | unsigned char state); | ||
| 447 | extern void br_mdb_init(void); | 449 | extern void br_mdb_init(void); |
| 450 | extern void br_mdb_uninit(void); | ||
| 448 | extern void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, | 451 | extern void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port, |
| 449 | struct br_ip *group, int type); | 452 | struct br_ip *group, int type); |
| 450 | 453 | ||
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 176ecdba4a22..4f9f5eb478f1 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
| @@ -439,8 +439,8 @@ exit: | |||
| 439 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 439 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |
| 440 | return NULL; | 440 | return NULL; |
| 441 | put_and_exit: | 441 | put_and_exit: |
| 442 | bh_unlock_sock(newsk); | 442 | inet_csk_prepare_forced_close(newsk); |
| 443 | sock_put(newsk); | 443 | dccp_done(newsk); |
| 444 | goto exit; | 444 | goto exit; |
| 445 | } | 445 | } |
| 446 | 446 | ||
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 56840b249f3b..6e05981f271e 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
| @@ -585,7 +585,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
| 585 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; | 585 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; |
| 586 | 586 | ||
| 587 | if (__inet_inherit_port(sk, newsk) < 0) { | 587 | if (__inet_inherit_port(sk, newsk) < 0) { |
| 588 | sock_put(newsk); | 588 | inet_csk_prepare_forced_close(newsk); |
| 589 | dccp_done(newsk); | ||
| 589 | goto out; | 590 | goto out; |
| 590 | } | 591 | } |
| 591 | __inet6_hash(newsk, NULL); | 592 | __inet6_hash(newsk, NULL); |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 2026542d6836..d0670f00d524 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -710,6 +710,22 @@ void inet_csk_destroy_sock(struct sock *sk) | |||
| 710 | } | 710 | } |
| 711 | EXPORT_SYMBOL(inet_csk_destroy_sock); | 711 | EXPORT_SYMBOL(inet_csk_destroy_sock); |
| 712 | 712 | ||
| 713 | /* This function allows to force a closure of a socket after the call to | ||
| 714 | * tcp/dccp_create_openreq_child(). | ||
| 715 | */ | ||
| 716 | void inet_csk_prepare_forced_close(struct sock *sk) | ||
| 717 | { | ||
| 718 | /* sk_clone_lock locked the socket and set refcnt to 2 */ | ||
| 719 | bh_unlock_sock(sk); | ||
| 720 | sock_put(sk); | ||
| 721 | |||
| 722 | /* The below has to be done to allow calling inet_csk_destroy_sock */ | ||
| 723 | sock_set_flag(sk, SOCK_DEAD); | ||
| 724 | percpu_counter_inc(sk->sk_prot->orphan_count); | ||
| 725 | inet_sk(sk)->inet_num = 0; | ||
| 726 | } | ||
| 727 | EXPORT_SYMBOL(inet_csk_prepare_forced_close); | ||
| 728 | |||
| 713 | int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) | 729 | int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) |
| 714 | { | 730 | { |
| 715 | struct inet_sock *inet = inet_sk(sk); | 731 | struct inet_sock *inet = inet_sk(sk); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 1ed230716d51..54139fa514e6 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1767,10 +1767,8 @@ exit: | |||
| 1767 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | 1767 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); |
| 1768 | return NULL; | 1768 | return NULL; |
| 1769 | put_and_exit: | 1769 | put_and_exit: |
| 1770 | tcp_clear_xmit_timers(newsk); | 1770 | inet_csk_prepare_forced_close(newsk); |
| 1771 | tcp_cleanup_congestion_control(newsk); | 1771 | tcp_done(newsk); |
| 1772 | bh_unlock_sock(newsk); | ||
| 1773 | sock_put(newsk); | ||
| 1774 | goto exit; | 1772 | goto exit; |
| 1775 | } | 1773 | } |
| 1776 | EXPORT_SYMBOL(tcp_v4_syn_recv_sock); | 1774 | EXPORT_SYMBOL(tcp_v4_syn_recv_sock); |
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 2068ac4fbdad..4ea244891b58 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile | |||
| @@ -41,6 +41,6 @@ obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o | |||
| 41 | obj-$(CONFIG_IPV6_GRE) += ip6_gre.o | 41 | obj-$(CONFIG_IPV6_GRE) += ip6_gre.o |
| 42 | 42 | ||
| 43 | obj-y += addrconf_core.o exthdrs_core.o | 43 | obj-y += addrconf_core.o exthdrs_core.o |
| 44 | obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6_offload) | 44 | obj-$(CONFIG_INET) += output_core.o protocol.o $(ipv6-offload) |
| 45 | 45 | ||
| 46 | obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o | 46 | obj-$(subst m,y,$(CONFIG_IPV6)) += inet6_hashtables.o |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6fca01f136ad..408cac4ae00a 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -534,8 +534,7 @@ void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex, | |||
| 534 | rtnl_notify(skb, net, 0, RTNLGRP_IPV6_NETCONF, NULL, GFP_ATOMIC); | 534 | rtnl_notify(skb, net, 0, RTNLGRP_IPV6_NETCONF, NULL, GFP_ATOMIC); |
| 535 | return; | 535 | return; |
| 536 | errout: | 536 | errout: |
| 537 | if (err < 0) | 537 | rtnl_set_sk_err(net, RTNLGRP_IPV6_NETCONF, err); |
| 538 | rtnl_set_sk_err(net, RTNLGRP_IPV6_NETCONF, err); | ||
| 539 | } | 538 | } |
| 540 | 539 | ||
| 541 | static const struct nla_policy devconf_ipv6_policy[NETCONFA_MAX+1] = { | 540 | static const struct nla_policy devconf_ipv6_policy[NETCONFA_MAX+1] = { |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index f2a007b7bde3..6574175795df 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
| @@ -1314,6 +1314,12 @@ out: | |||
| 1314 | 1314 | ||
| 1315 | static void ndisc_redirect_rcv(struct sk_buff *skb) | 1315 | static void ndisc_redirect_rcv(struct sk_buff *skb) |
| 1316 | { | 1316 | { |
| 1317 | u8 *hdr; | ||
| 1318 | struct ndisc_options ndopts; | ||
| 1319 | struct rd_msg *msg = (struct rd_msg *)skb_transport_header(skb); | ||
| 1320 | u32 ndoptlen = skb->tail - (skb->transport_header + | ||
| 1321 | offsetof(struct rd_msg, opt)); | ||
| 1322 | |||
| 1317 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 1323 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
| 1318 | switch (skb->ndisc_nodetype) { | 1324 | switch (skb->ndisc_nodetype) { |
| 1319 | case NDISC_NODETYPE_HOST: | 1325 | case NDISC_NODETYPE_HOST: |
| @@ -1330,6 +1336,17 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
| 1330 | return; | 1336 | return; |
| 1331 | } | 1337 | } |
| 1332 | 1338 | ||
| 1339 | if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) | ||
| 1340 | return; | ||
| 1341 | |||
| 1342 | if (!ndopts.nd_opts_rh) | ||
| 1343 | return; | ||
| 1344 | |||
| 1345 | hdr = (u8 *)ndopts.nd_opts_rh; | ||
| 1346 | hdr += 8; | ||
| 1347 | if (!pskb_pull(skb, hdr - skb_transport_header(skb))) | ||
| 1348 | return; | ||
| 1349 | |||
| 1333 | icmpv6_notify(skb, NDISC_REDIRECT, 0, 0); | 1350 | icmpv6_notify(skb, NDISC_REDIRECT, 0, 0); |
| 1334 | } | 1351 | } |
| 1335 | 1352 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 6565cf55eb1e..93825dd3a7c0 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1288,7 +1288,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
| 1288 | #endif | 1288 | #endif |
| 1289 | 1289 | ||
| 1290 | if (__inet_inherit_port(sk, newsk) < 0) { | 1290 | if (__inet_inherit_port(sk, newsk) < 0) { |
| 1291 | sock_put(newsk); | 1291 | inet_csk_prepare_forced_close(newsk); |
| 1292 | tcp_done(newsk); | ||
| 1292 | goto out; | 1293 | goto out; |
| 1293 | } | 1294 | } |
| 1294 | __inet6_hash(newsk, NULL); | 1295 | __inet6_hash(newsk, NULL); |
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c index e748aed290aa..b7c7f815deae 100644 --- a/net/mac802154/ieee802154_dev.c +++ b/net/mac802154/ieee802154_dev.c | |||
| @@ -224,9 +224,9 @@ void ieee802154_free_device(struct ieee802154_dev *hw) | |||
| 224 | 224 | ||
| 225 | BUG_ON(!list_empty(&priv->slaves)); | 225 | BUG_ON(!list_empty(&priv->slaves)); |
| 226 | 226 | ||
| 227 | wpan_phy_free(priv->phy); | ||
| 228 | |||
| 229 | mutex_destroy(&priv->slaves_mtx); | 227 | mutex_destroy(&priv->slaves_mtx); |
| 228 | |||
| 229 | wpan_phy_free(priv->phy); | ||
| 230 | } | 230 | } |
| 231 | EXPORT_SYMBOL(ieee802154_free_device); | 231 | EXPORT_SYMBOL(ieee802154_free_device); |
| 232 | 232 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index c8a1eb6eca2d..c0353d55d56f 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -669,6 +669,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, | |||
| 669 | struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; | 669 | struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; |
| 670 | int err; | 670 | int err; |
| 671 | 671 | ||
| 672 | if (addr_len < sizeof(struct sockaddr_nl)) | ||
| 673 | return -EINVAL; | ||
| 674 | |||
| 672 | if (nladdr->nl_family != AF_NETLINK) | 675 | if (nladdr->nl_family != AF_NETLINK) |
| 673 | return -EINVAL; | 676 | return -EINVAL; |
| 674 | 677 | ||
| @@ -2059,7 +2062,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v) | |||
| 2059 | struct sock *s = v; | 2062 | struct sock *s = v; |
| 2060 | struct netlink_sock *nlk = nlk_sk(s); | 2063 | struct netlink_sock *nlk = nlk_sk(s); |
| 2061 | 2064 | ||
| 2062 | seq_printf(seq, "%pK %-3d %-6d %08x %-8d %-8d %pK %-8d %-8d %-8lu\n", | 2065 | seq_printf(seq, "%pK %-3d %-6u %08x %-8d %-8d %pK %-8d %-8d %-8lu\n", |
| 2063 | s, | 2066 | s, |
| 2064 | s->sk_protocol, | 2067 | s->sk_protocol, |
| 2065 | nlk->portid, | 2068 | nlk->portid, |
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig index a9edd2e205f4..c26210618e14 100644 --- a/net/sctp/Kconfig +++ b/net/sctp/Kconfig | |||
| @@ -66,12 +66,36 @@ config SCTP_DBG_OBJCNT | |||
| 66 | 'cat /proc/net/sctp/sctp_dbg_objcnt' | 66 | 'cat /proc/net/sctp/sctp_dbg_objcnt' |
| 67 | 67 | ||
| 68 | If unsure, say N | 68 | If unsure, say N |
| 69 | choice | ||
| 70 | prompt "Default SCTP cookie HMAC encoding" | ||
| 71 | default SCTP_COOKIE_HMAC_MD5 | ||
| 72 | help | ||
| 73 | This option sets the default sctp cookie hmac algorithm | ||
| 74 | when in doubt select 'md5' | ||
| 75 | |||
| 76 | config SCTP_DEFAULT_COOKIE_HMAC_MD5 | ||
| 77 | bool "Enable optional MD5 hmac cookie generation" | ||
| 78 | help | ||
| 79 | Enable optional MD5 hmac based SCTP cookie generation | ||
| 80 | select SCTP_COOKIE_HMAC_MD5 | ||
| 81 | |||
| 82 | config SCTP_DEFAULT_COOKIE_HMAC_SHA1 | ||
| 83 | bool "Enable optional SHA1 hmac cookie generation" | ||
| 84 | help | ||
| 85 | Enable optional SHA1 hmac based SCTP cookie generation | ||
| 86 | select SCTP_COOKIE_HMAC_SHA1 | ||
| 87 | |||
| 88 | config SCTP_DEFAULT_COOKIE_HMAC_NONE | ||
| 89 | bool "Use no hmac alg in SCTP cookie generation" | ||
| 90 | help | ||
| 91 | Use no hmac algorithm in SCTP cookie generation | ||
| 92 | |||
| 93 | endchoice | ||
| 69 | 94 | ||
| 70 | config SCTP_COOKIE_HMAC_MD5 | 95 | config SCTP_COOKIE_HMAC_MD5 |
| 71 | bool "Enable optional MD5 hmac cookie generation" | 96 | bool "Enable optional MD5 hmac cookie generation" |
| 72 | help | 97 | help |
| 73 | Enable optional MD5 hmac based SCTP cookie generation | 98 | Enable optional MD5 hmac based SCTP cookie generation |
| 74 | default y | ||
| 75 | select CRYPTO_HMAC if SCTP_COOKIE_HMAC_MD5 | 99 | select CRYPTO_HMAC if SCTP_COOKIE_HMAC_MD5 |
| 76 | select CRYPTO_MD5 if SCTP_COOKIE_HMAC_MD5 | 100 | select CRYPTO_MD5 if SCTP_COOKIE_HMAC_MD5 |
| 77 | 101 | ||
| @@ -79,7 +103,6 @@ config SCTP_COOKIE_HMAC_SHA1 | |||
| 79 | bool "Enable optional SHA1 hmac cookie generation" | 103 | bool "Enable optional SHA1 hmac cookie generation" |
| 80 | help | 104 | help |
| 81 | Enable optional SHA1 hmac based SCTP cookie generation | 105 | Enable optional SHA1 hmac based SCTP cookie generation |
| 82 | default y | ||
| 83 | select CRYPTO_HMAC if SCTP_COOKIE_HMAC_SHA1 | 106 | select CRYPTO_HMAC if SCTP_COOKIE_HMAC_SHA1 |
| 84 | select CRYPTO_SHA1 if SCTP_COOKIE_HMAC_SHA1 | 107 | select CRYPTO_SHA1 if SCTP_COOKIE_HMAC_SHA1 |
| 85 | 108 | ||
diff --git a/net/sctp/probe.c b/net/sctp/probe.c index bc6cd75cc1dc..5f7518de2fd1 100644 --- a/net/sctp/probe.c +++ b/net/sctp/probe.c | |||
| @@ -122,7 +122,8 @@ static const struct file_operations sctpprobe_fops = { | |||
| 122 | .llseek = noop_llseek, | 122 | .llseek = noop_llseek, |
| 123 | }; | 123 | }; |
| 124 | 124 | ||
| 125 | sctp_disposition_t jsctp_sf_eat_sack(const struct sctp_endpoint *ep, | 125 | sctp_disposition_t jsctp_sf_eat_sack(struct net *net, |
| 126 | const struct sctp_endpoint *ep, | ||
| 126 | const struct sctp_association *asoc, | 127 | const struct sctp_association *asoc, |
| 127 | const sctp_subtype_t type, | 128 | const sctp_subtype_t type, |
| 128 | void *arg, | 129 | void *arg, |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 2c7785bacf74..f898b1c58bd2 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
| @@ -1191,9 +1191,9 @@ static int __net_init sctp_net_init(struct net *net) | |||
| 1191 | net->sctp.cookie_preserve_enable = 1; | 1191 | net->sctp.cookie_preserve_enable = 1; |
| 1192 | 1192 | ||
| 1193 | /* Default sctp sockets to use md5 as their hmac alg */ | 1193 | /* Default sctp sockets to use md5 as their hmac alg */ |
| 1194 | #if defined (CONFIG_CRYPTO_MD5) | 1194 | #if defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5) |
| 1195 | net->sctp.sctp_hmac_alg = "md5"; | 1195 | net->sctp.sctp_hmac_alg = "md5"; |
| 1196 | #elif defined (CONFIG_CRYPTO_SHA1) | 1196 | #elif defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1) |
| 1197 | net->sctp.sctp_hmac_alg = "sha1"; | 1197 | net->sctp.sctp_hmac_alg = "sha1"; |
| 1198 | #else | 1198 | #else |
| 1199 | net->sctp.sctp_hmac_alg = NULL; | 1199 | net->sctp.sctp_hmac_alg = NULL; |
