aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-05-16 22:17:37 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-16 22:17:37 -0400
commit028940342a906db8da014a7603a0deddc2c323dd (patch)
tree688dbc38a3e218f2493d311b1d70a67668837347 /net
parentbe3eed2e96340d3c7a4d1ea1d63e7bd6095d1e34 (diff)
parent0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c2
-rw-r--r--net/bluetooth/af_bluetooth.c2
-rw-r--r--net/bluetooth/hci_core.c8
-rw-r--r--net/bluetooth/hci_event.c11
-rw-r--r--net/bluetooth/l2cap_core.c5
-rw-r--r--net/bluetooth/l2cap_sock.c12
-rw-r--r--net/core/dev.c36
-rw-r--r--net/core/pktgen.c10
-rw-r--r--net/ipv4/fib_trie.c2
-rw-r--r--net/netfilter/ipset/ip_set_hash_ip.c10
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipport.c10
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipportip.c10
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipportnet.c10
-rw-r--r--net/netfilter/ipset/ip_set_hash_net.c10
-rw-r--r--net/netfilter/ipset/ip_set_hash_netiface.c10
-rw-r--r--net/netfilter/ipset/ip_set_hash_netport.c10
-rw-r--r--net/openvswitch/datapath.c29
-rw-r--r--net/openvswitch/flow.c3
-rw-r--r--net/sctp/output.c4
-rw-r--r--net/sctp/transport.c17
-rw-r--r--net/sunrpc/auth_gss/gss_mech_switch.c7
21 files changed, 121 insertions, 97 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index eaf5f21b0ef7..da1bc9c3cf38 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -157,7 +157,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
157 skb = __vlan_hwaccel_put_tag(skb, vlan_tci); 157 skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
158 } 158 }
159 159
160 skb_set_dev(skb, vlan_dev_priv(dev)->real_dev); 160 skb->dev = vlan_dev_priv(dev)->real_dev;
161 len = skb->len; 161 len = skb->len;
162 if (netpoll_tx_running(dev)) 162 if (netpoll_tx_running(dev))
163 return skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev); 163 return skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev);
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 72eb187a5f60..6fb68a9743af 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -450,7 +450,7 @@ unsigned int bt_sock_poll(struct file *file, struct socket *sock, poll_table *wa
450 sk->sk_state == BT_CONFIG) 450 sk->sk_state == BT_CONFIG)
451 return mask; 451 return mask;
452 452
453 if (sock_writeable(sk)) 453 if (!bt_sk(sk)->suspended && sock_writeable(sk))
454 mask |= POLLOUT | POLLWRNORM | POLLWRBAND; 454 mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
455 else 455 else
456 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); 456 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index edfd61addcec..d6dc44cd15b0 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2784,6 +2784,14 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
2784 if (conn) { 2784 if (conn) {
2785 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); 2785 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
2786 2786
2787 hci_dev_lock(hdev);
2788 if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
2789 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
2790 mgmt_device_connected(hdev, &conn->dst, conn->type,
2791 conn->dst_type, 0, NULL, 0,
2792 conn->dev_class);
2793 hci_dev_unlock(hdev);
2794
2787 /* Send to upper protocol */ 2795 /* Send to upper protocol */
2788 l2cap_recv_acldata(conn, skb, flags); 2796 l2cap_recv_acldata(conn, skb, flags);
2789 return; 2797 return;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 6c065254afc0..1266f78fa8e3 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2039,6 +2039,12 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
2039 2039
2040 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); 2040 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
2041 2041
2042 if (ev->status && conn->state == BT_CONNECTED) {
2043 hci_acl_disconn(conn, 0x13);
2044 hci_conn_put(conn);
2045 goto unlock;
2046 }
2047
2042 if (conn->state == BT_CONFIG) { 2048 if (conn->state == BT_CONFIG) {
2043 if (!ev->status) 2049 if (!ev->status)
2044 conn->state = BT_CONNECTED; 2050 conn->state = BT_CONNECTED;
@@ -2049,6 +2055,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
2049 hci_encrypt_cfm(conn, ev->status, ev->encrypt); 2055 hci_encrypt_cfm(conn, ev->status, ev->encrypt);
2050 } 2056 }
2051 2057
2058unlock:
2052 hci_dev_unlock(hdev); 2059 hci_dev_unlock(hdev);
2053} 2060}
2054 2061
@@ -2102,7 +2109,7 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
2102 goto unlock; 2109 goto unlock;
2103 } 2110 }
2104 2111
2105 if (!ev->status) { 2112 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
2106 struct hci_cp_remote_name_req cp; 2113 struct hci_cp_remote_name_req cp;
2107 memset(&cp, 0, sizeof(cp)); 2114 memset(&cp, 0, sizeof(cp));
2108 bacpy(&cp.bdaddr, &conn->dst); 2115 bacpy(&cp.bdaddr, &conn->dst);
@@ -2871,7 +2878,7 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
2871 if (conn->state != BT_CONFIG) 2878 if (conn->state != BT_CONFIG)
2872 goto unlock; 2879 goto unlock;
2873 2880
2874 if (!ev->status) { 2881 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
2875 struct hci_cp_remote_name_req cp; 2882 struct hci_cp_remote_name_req cp;
2876 memset(&cp, 0, sizeof(cp)); 2883 memset(&cp, 0, sizeof(cp));
2877 bacpy(&cp.bdaddr, &conn->dst); 2884 bacpy(&cp.bdaddr, &conn->dst);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 94552b33d528..6f9c25b633a6 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4589,6 +4589,11 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4589 4589
4590 if (!status && (chan->state == BT_CONNECTED || 4590 if (!status && (chan->state == BT_CONNECTED ||
4591 chan->state == BT_CONFIG)) { 4591 chan->state == BT_CONFIG)) {
4592 struct sock *sk = chan->sk;
4593
4594 bt_sk(sk)->suspended = false;
4595 sk->sk_state_change(sk);
4596
4592 l2cap_check_encryption(chan, encrypt); 4597 l2cap_check_encryption(chan, encrypt);
4593 l2cap_chan_unlock(chan); 4598 l2cap_chan_unlock(chan);
4594 continue; 4599 continue;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 29122ed28ea9..04e7c172d49c 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -592,10 +592,14 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
592 sk->sk_state = BT_CONFIG; 592 sk->sk_state = BT_CONFIG;
593 chan->state = BT_CONFIG; 593 chan->state = BT_CONFIG;
594 594
595 /* or for ACL link, under defer_setup time */ 595 /* or for ACL link */
596 } else if (sk->sk_state == BT_CONNECT2 && 596 } else if ((sk->sk_state == BT_CONNECT2 &&
597 bt_sk(sk)->defer_setup) { 597 bt_sk(sk)->defer_setup) ||
598 err = l2cap_chan_check_security(chan); 598 sk->sk_state == BT_CONNECTED) {
599 if (!l2cap_chan_check_security(chan))
600 bt_sk(sk)->suspended = true;
601 else
602 sk->sk_state_change(sk);
599 } else { 603 } else {
600 err = -EINVAL; 604 err = -EINVAL;
601 } 605 }
diff --git a/net/core/dev.c b/net/core/dev.c
index 66cae6e975d9..33684b6e95e2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1616,10 +1616,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1616 return NET_RX_DROP; 1616 return NET_RX_DROP;
1617 } 1617 }
1618 skb->skb_iif = 0; 1618 skb->skb_iif = 0;
1619 skb_set_dev(skb, dev); 1619 skb->dev = dev;
1620 skb_dst_drop(skb);
1620 skb->tstamp.tv64 = 0; 1621 skb->tstamp.tv64 = 0;
1621 skb->pkt_type = PACKET_HOST; 1622 skb->pkt_type = PACKET_HOST;
1622 skb->protocol = eth_type_trans(skb, dev); 1623 skb->protocol = eth_type_trans(skb, dev);
1624 skb->mark = 0;
1625 secpath_reset(skb);
1626 nf_reset(skb);
1623 return netif_rx(skb); 1627 return netif_rx(skb);
1624} 1628}
1625EXPORT_SYMBOL_GPL(dev_forward_skb); 1629EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -1867,36 +1871,6 @@ void netif_device_attach(struct net_device *dev)
1867} 1871}
1868EXPORT_SYMBOL(netif_device_attach); 1872EXPORT_SYMBOL(netif_device_attach);
1869 1873
1870/**
1871 * skb_dev_set -- assign a new device to a buffer
1872 * @skb: buffer for the new device
1873 * @dev: network device
1874 *
1875 * If an skb is owned by a device already, we have to reset
1876 * all data private to the namespace a device belongs to
1877 * before assigning it a new device.
1878 */
1879#ifdef CONFIG_NET_NS
1880void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1881{
1882 skb_dst_drop(skb);
1883 if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
1884 secpath_reset(skb);
1885 nf_reset(skb);
1886 skb_init_secmark(skb);
1887 skb->mark = 0;
1888 skb->priority = 0;
1889 skb->nf_trace = 0;
1890 skb->ipvs_property = 0;
1891#ifdef CONFIG_NET_SCHED
1892 skb->tc_index = 0;
1893#endif
1894 }
1895 skb->dev = dev;
1896}
1897EXPORT_SYMBOL(skb_set_dev);
1898#endif /* CONFIG_NET_NS */
1899
1900static void skb_warn_bad_offload(const struct sk_buff *skb) 1874static void skb_warn_bad_offload(const struct sk_buff *skb)
1901{ 1875{
1902 static const netdev_features_t null_features = 0; 1876 static const netdev_features_t null_features = 0;
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 33912573959d..70236db0fb4f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused,
1931{ 1931{
1932 struct net_device *dev = ptr; 1932 struct net_device *dev = ptr;
1933 1933
1934 if (!net_eq(dev_net(dev), &init_net)) 1934 if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
1935 return NOTIFY_DONE; 1935 return NOTIFY_DONE;
1936 1936
1937 /* It is OK that we do not hold the group lock right now, 1937 /* It is OK that we do not hold the group lock right now,
@@ -3754,12 +3754,18 @@ static void __exit pg_cleanup(void)
3754{ 3754{
3755 struct pktgen_thread *t; 3755 struct pktgen_thread *t;
3756 struct list_head *q, *n; 3756 struct list_head *q, *n;
3757 struct list_head list;
3757 3758
3758 /* Stop all interfaces & threads */ 3759 /* Stop all interfaces & threads */
3759 pktgen_exiting = true; 3760 pktgen_exiting = true;
3760 3761
3761 list_for_each_safe(q, n, &pktgen_threads) { 3762 mutex_lock(&pktgen_thread_lock);
3763 list_splice(&list, &pktgen_threads);
3764 mutex_unlock(&pktgen_thread_lock);
3765
3766 list_for_each_safe(q, n, &list) {
3762 t = list_entry(q, struct pktgen_thread, th_list); 3767 t = list_entry(q, struct pktgen_thread, th_list);
3768 list_del(&t->th_list);
3763 kthread_stop(t->tsk); 3769 kthread_stop(t->tsk);
3764 kfree(t); 3770 kfree(t);
3765 } 3771 }
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index bce36f1a37b4..30b88d7b4bd6 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1370,6 +1370,8 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
1370 1370
1371 if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos) 1371 if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos)
1372 continue; 1372 continue;
1373 if (fi->fib_dead)
1374 continue;
1373 if (fa->fa_info->fib_scope < flp->flowi4_scope) 1375 if (fa->fa_info->fib_scope < flp->flowi4_scope)
1374 continue; 1376 continue;
1375 fib_alias_accessed(fa); 1377 fib_alias_accessed(fa);
diff --git a/net/netfilter/ipset/ip_set_hash_ip.c b/net/netfilter/ipset/ip_set_hash_ip.c
index 507fe93794aa..a68dbd4f1e4e 100644
--- a/net/netfilter/ipset/ip_set_hash_ip.c
+++ b/net/netfilter/ipset/ip_set_hash_ip.c
@@ -368,6 +368,7 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
368{ 368{
369 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 369 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
370 u8 netmask, hbits; 370 u8 netmask, hbits;
371 size_t hsize;
371 struct ip_set_hash *h; 372 struct ip_set_hash *h;
372 373
373 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 374 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
@@ -409,9 +410,12 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
409 h->timeout = IPSET_NO_TIMEOUT; 410 h->timeout = IPSET_NO_TIMEOUT;
410 411
411 hbits = htable_bits(hashsize); 412 hbits = htable_bits(hashsize);
412 h->table = ip_set_alloc( 413 hsize = htable_size(hbits);
413 sizeof(struct htable) 414 if (hsize == 0) {
414 + jhash_size(hbits) * sizeof(struct hbucket)); 415 kfree(h);
416 return -ENOMEM;
417 }
418 h->table = ip_set_alloc(hsize);
415 if (!h->table) { 419 if (!h->table) {
416 kfree(h); 420 kfree(h);
417 return -ENOMEM; 421 return -ENOMEM;
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c
index 68f284c97490..92722bb82eea 100644
--- a/net/netfilter/ipset/ip_set_hash_ipport.c
+++ b/net/netfilter/ipset/ip_set_hash_ipport.c
@@ -452,6 +452,7 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
452 struct ip_set_hash *h; 452 struct ip_set_hash *h;
453 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 453 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
454 u8 hbits; 454 u8 hbits;
455 size_t hsize;
455 456
456 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 457 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
457 return -IPSET_ERR_INVALID_FAMILY; 458 return -IPSET_ERR_INVALID_FAMILY;
@@ -479,9 +480,12 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
479 h->timeout = IPSET_NO_TIMEOUT; 480 h->timeout = IPSET_NO_TIMEOUT;
480 481
481 hbits = htable_bits(hashsize); 482 hbits = htable_bits(hashsize);
482 h->table = ip_set_alloc( 483 hsize = htable_size(hbits);
483 sizeof(struct htable) 484 if (hsize == 0) {
484 + jhash_size(hbits) * sizeof(struct hbucket)); 485 kfree(h);
486 return -ENOMEM;
487 }
488 h->table = ip_set_alloc(hsize);
485 if (!h->table) { 489 if (!h->table) {
486 kfree(h); 490 kfree(h);
487 return -ENOMEM; 491 return -ENOMEM;
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c
index 1eec4b9e0dca..0637ce096def 100644
--- a/net/netfilter/ipset/ip_set_hash_ipportip.c
+++ b/net/netfilter/ipset/ip_set_hash_ipportip.c
@@ -470,6 +470,7 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
470 struct ip_set_hash *h; 470 struct ip_set_hash *h;
471 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 471 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
472 u8 hbits; 472 u8 hbits;
473 size_t hsize;
473 474
474 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 475 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
475 return -IPSET_ERR_INVALID_FAMILY; 476 return -IPSET_ERR_INVALID_FAMILY;
@@ -497,9 +498,12 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
497 h->timeout = IPSET_NO_TIMEOUT; 498 h->timeout = IPSET_NO_TIMEOUT;
498 499
499 hbits = htable_bits(hashsize); 500 hbits = htable_bits(hashsize);
500 h->table = ip_set_alloc( 501 hsize = htable_size(hbits);
501 sizeof(struct htable) 502 if (hsize == 0) {
502 + jhash_size(hbits) * sizeof(struct hbucket)); 503 kfree(h);
504 return -ENOMEM;
505 }
506 h->table = ip_set_alloc(hsize);
503 if (!h->table) { 507 if (!h->table) {
504 kfree(h); 508 kfree(h);
505 return -ENOMEM; 509 return -ENOMEM;
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c
index 62d66ecef369..1ce21ca976e1 100644
--- a/net/netfilter/ipset/ip_set_hash_ipportnet.c
+++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c
@@ -619,6 +619,7 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
619 struct ip_set_hash *h; 619 struct ip_set_hash *h;
620 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 620 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
621 u8 hbits; 621 u8 hbits;
622 size_t hsize;
622 623
623 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 624 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
624 return -IPSET_ERR_INVALID_FAMILY; 625 return -IPSET_ERR_INVALID_FAMILY;
@@ -648,9 +649,12 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
648 h->timeout = IPSET_NO_TIMEOUT; 649 h->timeout = IPSET_NO_TIMEOUT;
649 650
650 hbits = htable_bits(hashsize); 651 hbits = htable_bits(hashsize);
651 h->table = ip_set_alloc( 652 hsize = htable_size(hbits);
652 sizeof(struct htable) 653 if (hsize == 0) {
653 + jhash_size(hbits) * sizeof(struct hbucket)); 654 kfree(h);
655 return -ENOMEM;
656 }
657 h->table = ip_set_alloc(hsize);
654 if (!h->table) { 658 if (!h->table) {
655 kfree(h); 659 kfree(h);
656 return -ENOMEM; 660 return -ENOMEM;
diff --git a/net/netfilter/ipset/ip_set_hash_net.c b/net/netfilter/ipset/ip_set_hash_net.c
index 6607a814be57..c57a6a09906d 100644
--- a/net/netfilter/ipset/ip_set_hash_net.c
+++ b/net/netfilter/ipset/ip_set_hash_net.c
@@ -463,6 +463,7 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
463 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 463 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
464 struct ip_set_hash *h; 464 struct ip_set_hash *h;
465 u8 hbits; 465 u8 hbits;
466 size_t hsize;
466 467
467 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 468 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
468 return -IPSET_ERR_INVALID_FAMILY; 469 return -IPSET_ERR_INVALID_FAMILY;
@@ -492,9 +493,12 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
492 h->timeout = IPSET_NO_TIMEOUT; 493 h->timeout = IPSET_NO_TIMEOUT;
493 494
494 hbits = htable_bits(hashsize); 495 hbits = htable_bits(hashsize);
495 h->table = ip_set_alloc( 496 hsize = htable_size(hbits);
496 sizeof(struct htable) 497 if (hsize == 0) {
497 + jhash_size(hbits) * sizeof(struct hbucket)); 498 kfree(h);
499 return -ENOMEM;
500 }
501 h->table = ip_set_alloc(hsize);
498 if (!h->table) { 502 if (!h->table) {
499 kfree(h); 503 kfree(h);
500 return -ENOMEM; 504 return -ENOMEM;
diff --git a/net/netfilter/ipset/ip_set_hash_netiface.c b/net/netfilter/ipset/ip_set_hash_netiface.c
index 6093f3daa911..ee863943c826 100644
--- a/net/netfilter/ipset/ip_set_hash_netiface.c
+++ b/net/netfilter/ipset/ip_set_hash_netiface.c
@@ -726,6 +726,7 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
726 struct ip_set_hash *h; 726 struct ip_set_hash *h;
727 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 727 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
728 u8 hbits; 728 u8 hbits;
729 size_t hsize;
729 730
730 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 731 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
731 return -IPSET_ERR_INVALID_FAMILY; 732 return -IPSET_ERR_INVALID_FAMILY;
@@ -756,9 +757,12 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
756 h->ahash_max = AHASH_MAX_SIZE; 757 h->ahash_max = AHASH_MAX_SIZE;
757 758
758 hbits = htable_bits(hashsize); 759 hbits = htable_bits(hashsize);
759 h->table = ip_set_alloc( 760 hsize = htable_size(hbits);
760 sizeof(struct htable) 761 if (hsize == 0) {
761 + jhash_size(hbits) * sizeof(struct hbucket)); 762 kfree(h);
763 return -ENOMEM;
764 }
765 h->table = ip_set_alloc(hsize);
762 if (!h->table) { 766 if (!h->table) {
763 kfree(h); 767 kfree(h);
764 return -ENOMEM; 768 return -ENOMEM;
diff --git a/net/netfilter/ipset/ip_set_hash_netport.c b/net/netfilter/ipset/ip_set_hash_netport.c
index ae3c644adc14..fc3143a2d41b 100644
--- a/net/netfilter/ipset/ip_set_hash_netport.c
+++ b/net/netfilter/ipset/ip_set_hash_netport.c
@@ -575,6 +575,7 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
575 struct ip_set_hash *h; 575 struct ip_set_hash *h;
576 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM; 576 u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
577 u8 hbits; 577 u8 hbits;
578 size_t hsize;
578 579
579 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 580 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
580 return -IPSET_ERR_INVALID_FAMILY; 581 return -IPSET_ERR_INVALID_FAMILY;
@@ -604,9 +605,12 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
604 h->timeout = IPSET_NO_TIMEOUT; 605 h->timeout = IPSET_NO_TIMEOUT;
605 606
606 hbits = htable_bits(hashsize); 607 hbits = htable_bits(hashsize);
607 h->table = ip_set_alloc( 608 hsize = htable_size(hbits);
608 sizeof(struct htable) 609 if (hsize == 0) {
609 + jhash_size(hbits) * sizeof(struct hbucket)); 610 kfree(h);
611 return -ENOMEM;
612 }
613 h->table = ip_set_alloc(hsize);
610 if (!h->table) { 614 if (!h->table) {
611 kfree(h); 615 kfree(h);
612 return -ENOMEM; 616 return -ENOMEM;
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index f86de29979ef..2c74daa5aca5 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -321,7 +321,7 @@ static int queue_userspace_packet(int dp_ifindex, struct sk_buff *skb,
321 return -ENOMEM; 321 return -ENOMEM;
322 322
323 nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb)); 323 nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb));
324 if (!skb) 324 if (!nskb)
325 return -ENOMEM; 325 return -ENOMEM;
326 326
327 nskb->vlan_tci = 0; 327 nskb->vlan_tci = 0;
@@ -421,6 +421,19 @@ static int validate_sample(const struct nlattr *attr,
421 return validate_actions(actions, key, depth + 1); 421 return validate_actions(actions, key, depth + 1);
422} 422}
423 423
424static int validate_tp_port(const struct sw_flow_key *flow_key)
425{
426 if (flow_key->eth.type == htons(ETH_P_IP)) {
427 if (flow_key->ipv4.tp.src && flow_key->ipv4.tp.dst)
428 return 0;
429 } else if (flow_key->eth.type == htons(ETH_P_IPV6)) {
430 if (flow_key->ipv6.tp.src && flow_key->ipv6.tp.dst)
431 return 0;
432 }
433
434 return -EINVAL;
435}
436
424static int validate_set(const struct nlattr *a, 437static int validate_set(const struct nlattr *a,
425 const struct sw_flow_key *flow_key) 438 const struct sw_flow_key *flow_key)
426{ 439{
@@ -462,18 +475,13 @@ static int validate_set(const struct nlattr *a,
462 if (flow_key->ip.proto != IPPROTO_TCP) 475 if (flow_key->ip.proto != IPPROTO_TCP)
463 return -EINVAL; 476 return -EINVAL;
464 477
465 if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst) 478 return validate_tp_port(flow_key);
466 return -EINVAL;
467
468 break;
469 479
470 case OVS_KEY_ATTR_UDP: 480 case OVS_KEY_ATTR_UDP:
471 if (flow_key->ip.proto != IPPROTO_UDP) 481 if (flow_key->ip.proto != IPPROTO_UDP)
472 return -EINVAL; 482 return -EINVAL;
473 483
474 if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst) 484 return validate_tp_port(flow_key);
475 return -EINVAL;
476 break;
477 485
478 default: 486 default:
479 return -EINVAL; 487 return -EINVAL;
@@ -1647,10 +1655,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
1647 reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq, 1655 reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
1648 OVS_VPORT_CMD_NEW); 1656 OVS_VPORT_CMD_NEW);
1649 if (IS_ERR(reply)) { 1657 if (IS_ERR(reply)) {
1650 err = PTR_ERR(reply);
1651 netlink_set_err(init_net.genl_sock, 0, 1658 netlink_set_err(init_net.genl_sock, 0,
1652 ovs_dp_vport_multicast_group.id, err); 1659 ovs_dp_vport_multicast_group.id, PTR_ERR(reply));
1653 return 0; 1660 goto exit_unlock;
1654 } 1661 }
1655 1662
1656 genl_notify(reply, genl_info_net(info), info->snd_pid, 1663 genl_notify(reply, genl_info_net(info), info->snd_pid,
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 7cb416381e87..6d4d8097cf96 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -183,7 +183,8 @@ void ovs_flow_used(struct sw_flow *flow, struct sk_buff *skb)
183 u8 tcp_flags = 0; 183 u8 tcp_flags = 0;
184 184
185 if (flow->key.eth.type == htons(ETH_P_IP) && 185 if (flow->key.eth.type == htons(ETH_P_IP) &&
186 flow->key.ip.proto == IPPROTO_TCP) { 186 flow->key.ip.proto == IPPROTO_TCP &&
187 likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) {
187 u8 *tcp = (u8 *)tcp_hdr(skb); 188 u8 *tcp = (u8 *)tcp_hdr(skb);
188 tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK; 189 tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK;
189 } 190 }
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 69534c5f8afa..f1b7d4bb591e 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -377,9 +377,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
377 */ 377 */
378 skb_set_owner_w(nskb, sk); 378 skb_set_owner_w(nskb, sk);
379 379
380 /* The 'obsolete' field of dst is set to 2 when a dst is freed. */ 380 if (!sctp_transport_dst_check(tp)) {
381 if (!dst || (dst->obsolete > 1)) {
382 dst_release(dst);
383 sctp_transport_route(tp, NULL, sctp_sk(sk)); 381 sctp_transport_route(tp, NULL, sctp_sk(sk));
384 if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) { 382 if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
385 sctp_assoc_sync_pmtu(asoc); 383 sctp_assoc_sync_pmtu(asoc);
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 3889330b7b04..b026ba0c6992 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -226,23 +226,6 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
226 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; 226 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
227} 227}
228 228
229/* this is a complete rip-off from __sk_dst_check
230 * the cookie is always 0 since this is how it's used in the
231 * pmtu code
232 */
233static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
234{
235 struct dst_entry *dst = t->dst;
236
237 if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) {
238 dst_release(t->dst);
239 t->dst = NULL;
240 return NULL;
241 }
242
243 return dst;
244}
245
246void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) 229void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
247{ 230{
248 struct dst_entry *dst; 231 struct dst_entry *dst;
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index ca8cad8251c7..782bfe1b6465 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -242,12 +242,13 @@ EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor);
242int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr) 242int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr)
243{ 243{
244 struct gss_api_mech *pos = NULL; 244 struct gss_api_mech *pos = NULL;
245 int i = 0; 245 int j, i = 0;
246 246
247 spin_lock(&registered_mechs_lock); 247 spin_lock(&registered_mechs_lock);
248 list_for_each_entry(pos, &registered_mechs, gm_list) { 248 list_for_each_entry(pos, &registered_mechs, gm_list) {
249 array_ptr[i] = pos->gm_pfs->pseudoflavor; 249 for (j=0; j < pos->gm_pf_num; j++) {
250 i++; 250 array_ptr[i++] = pos->gm_pfs[j].pseudoflavor;
251 }
251 } 252 }
252 spin_unlock(&registered_mechs_lock); 253 spin_unlock(&registered_mechs_lock);
253 return i; 254 return i;