aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-11-22 11:29:28 -0500
committerDavid S. Miller <davem@davemloft.net>2016-11-22 13:27:16 -0500
commitf9aa9dc7d2d00e6eb02168ffc64ef614b89d7998 (patch)
tree061b767ccf7d6955cc4fb921c230a787d194392e /net
parent06b37b650cf826349677564cb0ff1560ed8e51fc (diff)
parent3b404a519815b9820f73f1ecf404e5546c9270ba (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
All conflicts were simple overlapping changes except perhaps for the Thunder driver. That driver has a change_mtu method explicitly for sending a message to the hardware. If that fails it returns an error. Normally a driver doesn't need an ndo_change_mtu method becuase those are usually just range changes, which are now handled generically. But since this extra operation is needed in the Thunder driver, it has to stay. However, if the message send fails we have to restore the original MTU before the change because the entire call chain expects that if an error is thrown by ndo_change_mtu then the MTU did not change. Therefore code is added to nicvf_change_mtu to remember the original MTU, and to restore it upon nicvf_update_hw_max_frs() failue. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/batman-adv/hard-interface.c1
-rw-r--r--net/batman-adv/tp_meter.c1
-rw-r--r--net/core/net_namespace.c2
-rw-r--r--net/core/rtnetlink.c22
-rw-r--r--net/ipv4/fib_frontend.c20
-rw-r--r--net/ipv4/fib_trie.c69
-rw-r--r--net/ipv4/igmp.c50
-rw-r--r--net/ipv4/tcp_cong.c4
-rw-r--r--net/ipv4/udp.c6
-rw-r--r--net/ipv6/ip6_tunnel.c13
-rw-r--r--net/ipv6/udp.c6
-rw-r--r--net/l2tp/l2tp_eth.c2
-rw-r--r--net/l2tp/l2tp_ip.c5
-rw-r--r--net/l2tp/l2tp_ip6.c5
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/mac80211/tx.c14
-rw-r--r--net/mac80211/vht.c16
-rw-r--r--net/sched/cls_api.c5
-rw-r--r--net/socket.c15
-rw-r--r--net/sunrpc/svc_xprt.c11
-rw-r--r--net/sunrpc/svcsock.c21
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c6
-rw-r--r--net/tipc/socket.c48
-rw-r--r--net/unix/af_unix.c17
-rw-r--r--net/wireless/core.h1
-rw-r--r--net/wireless/scan.c69
-rw-r--r--net/wireless/util.c3
27 files changed, 321 insertions, 113 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 672150b42c61..61a431a9772b 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -851,6 +851,7 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
851 batadv_softif_destroy_sysfs(hard_iface->soft_iface); 851 batadv_softif_destroy_sysfs(hard_iface->soft_iface);
852 } 852 }
853 853
854 hard_iface->soft_iface = NULL;
854 batadv_hardif_put(hard_iface); 855 batadv_hardif_put(hard_iface);
855 856
856out: 857out:
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index f1564520dfae..981e8c5b07e9 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -834,6 +834,7 @@ static int batadv_tp_send(void *arg)
834 primary_if = batadv_primary_if_get_selected(bat_priv); 834 primary_if = batadv_primary_if_get_selected(bat_priv);
835 if (unlikely(!primary_if)) { 835 if (unlikely(!primary_if)) {
836 err = BATADV_TP_REASON_DST_UNREACHABLE; 836 err = BATADV_TP_REASON_DST_UNREACHABLE;
837 tp_vars->reason = err;
837 goto out; 838 goto out;
838 } 839 }
839 840
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 35d37b196e67..a38feac547d7 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -218,6 +218,8 @@ int peernet2id_alloc(struct net *net, struct net *peer)
218 bool alloc; 218 bool alloc;
219 int id; 219 int id;
220 220
221 if (atomic_read(&net->count) == 0)
222 return NETNSA_NSID_NOT_ASSIGNED;
221 spin_lock_irqsave(&net->nsid_lock, flags); 223 spin_lock_irqsave(&net->nsid_lock, flags);
222 alloc = atomic_read(&peer->count) == 0 ? false : true; 224 alloc = atomic_read(&peer->count) == 0 ? false : true;
223 id = __peernet2id_alloc(net, peer, &alloc); 225 id = __peernet2id_alloc(net, peer, &alloc);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index db313ec7af32..a99917b5de33 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -840,18 +840,20 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
840 if (dev->dev.parent && dev_is_pci(dev->dev.parent) && 840 if (dev->dev.parent && dev_is_pci(dev->dev.parent) &&
841 (ext_filter_mask & RTEXT_FILTER_VF)) { 841 (ext_filter_mask & RTEXT_FILTER_VF)) {
842 int num_vfs = dev_num_vf(dev->dev.parent); 842 int num_vfs = dev_num_vf(dev->dev.parent);
843 size_t size = nla_total_size(sizeof(struct nlattr)); 843 size_t size = nla_total_size(0);
844 size += nla_total_size(num_vfs * sizeof(struct nlattr));
845 size += num_vfs * 844 size += num_vfs *
846 (nla_total_size(sizeof(struct ifla_vf_mac)) + 845 (nla_total_size(0) +
847 nla_total_size(MAX_VLAN_LIST_LEN * 846 nla_total_size(sizeof(struct ifla_vf_mac)) +
848 sizeof(struct nlattr)) + 847 nla_total_size(sizeof(struct ifla_vf_vlan)) +
848 nla_total_size(0) + /* nest IFLA_VF_VLAN_LIST */
849 nla_total_size(MAX_VLAN_LIST_LEN * 849 nla_total_size(MAX_VLAN_LIST_LEN *
850 sizeof(struct ifla_vf_vlan_info)) + 850 sizeof(struct ifla_vf_vlan_info)) +
851 nla_total_size(sizeof(struct ifla_vf_spoofchk)) + 851 nla_total_size(sizeof(struct ifla_vf_spoofchk)) +
852 nla_total_size(sizeof(struct ifla_vf_tx_rate)) +
852 nla_total_size(sizeof(struct ifla_vf_rate)) + 853 nla_total_size(sizeof(struct ifla_vf_rate)) +
853 nla_total_size(sizeof(struct ifla_vf_link_state)) + 854 nla_total_size(sizeof(struct ifla_vf_link_state)) +
854 nla_total_size(sizeof(struct ifla_vf_rss_query_en)) + 855 nla_total_size(sizeof(struct ifla_vf_rss_query_en)) +
856 nla_total_size(0) + /* nest IFLA_VF_STATS */
855 /* IFLA_VF_STATS_RX_PACKETS */ 857 /* IFLA_VF_STATS_RX_PACKETS */
856 nla_total_size_64bit(sizeof(__u64)) + 858 nla_total_size_64bit(sizeof(__u64)) +
857 /* IFLA_VF_STATS_TX_PACKETS */ 859 /* IFLA_VF_STATS_TX_PACKETS */
@@ -899,7 +901,8 @@ static size_t rtnl_port_size(const struct net_device *dev,
899 901
900static size_t rtnl_xdp_size(const struct net_device *dev) 902static size_t rtnl_xdp_size(const struct net_device *dev)
901{ 903{
902 size_t xdp_size = nla_total_size(1); /* XDP_ATTACHED */ 904 size_t xdp_size = nla_total_size(0) + /* nest IFLA_XDP */
905 nla_total_size(1); /* XDP_ATTACHED */
903 906
904 if (!dev->netdev_ops->ndo_xdp) 907 if (!dev->netdev_ops->ndo_xdp)
905 return 0; 908 return 0;
@@ -1606,7 +1609,7 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1606 head = &net->dev_index_head[h]; 1609 head = &net->dev_index_head[h];
1607 hlist_for_each_entry(dev, head, index_hlist) { 1610 hlist_for_each_entry(dev, head, index_hlist) {
1608 if (link_dump_filtered(dev, master_idx, kind_ops)) 1611 if (link_dump_filtered(dev, master_idx, kind_ops))
1609 continue; 1612 goto cont;
1610 if (idx < s_idx) 1613 if (idx < s_idx)
1611 goto cont; 1614 goto cont;
1612 err = rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, 1615 err = rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
@@ -2849,7 +2852,10 @@ nla_put_failure:
2849 2852
2850static inline size_t rtnl_fdb_nlmsg_size(void) 2853static inline size_t rtnl_fdb_nlmsg_size(void)
2851{ 2854{
2852 return NLMSG_ALIGN(sizeof(struct ndmsg)) + nla_total_size(ETH_ALEN); 2855 return NLMSG_ALIGN(sizeof(struct ndmsg)) +
2856 nla_total_size(ETH_ALEN) + /* NDA_LLADDR */
2857 nla_total_size(sizeof(u16)) + /* NDA_VLAN */
2858 0;
2853} 2859}
2854 2860
2855static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type, 2861static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, u16 vid, int type,
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d93eea8e2409..121384bbb40b 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -151,7 +151,7 @@ static void fib_replace_table(struct net *net, struct fib_table *old,
151 151
152int fib_unmerge(struct net *net) 152int fib_unmerge(struct net *net)
153{ 153{
154 struct fib_table *old, *new; 154 struct fib_table *old, *new, *main_table;
155 155
156 /* attempt to fetch local table if it has been allocated */ 156 /* attempt to fetch local table if it has been allocated */
157 old = fib_get_table(net, RT_TABLE_LOCAL); 157 old = fib_get_table(net, RT_TABLE_LOCAL);
@@ -162,11 +162,21 @@ int fib_unmerge(struct net *net)
162 if (!new) 162 if (!new)
163 return -ENOMEM; 163 return -ENOMEM;
164 164
165 /* table is already unmerged */
166 if (new == old)
167 return 0;
168
165 /* replace merged table with clean table */ 169 /* replace merged table with clean table */
166 if (new != old) { 170 fib_replace_table(net, old, new);
167 fib_replace_table(net, old, new); 171 fib_free_table(old);
168 fib_free_table(old); 172
169 } 173 /* attempt to fetch main table if it has been allocated */
174 main_table = fib_get_table(net, RT_TABLE_MAIN);
175 if (!main_table)
176 return 0;
177
178 /* flush local entries from main table */
179 fib_table_flush_external(main_table);
170 180
171 return 0; 181 return 0;
172} 182}
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 4cff74d4133f..026f309c51e9 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1743,8 +1743,10 @@ struct fib_table *fib_trie_unmerge(struct fib_table *oldtb)
1743 local_l = fib_find_node(lt, &local_tp, l->key); 1743 local_l = fib_find_node(lt, &local_tp, l->key);
1744 1744
1745 if (fib_insert_alias(lt, local_tp, local_l, new_fa, 1745 if (fib_insert_alias(lt, local_tp, local_l, new_fa,
1746 NULL, l->key)) 1746 NULL, l->key)) {
1747 kmem_cache_free(fn_alias_kmem, new_fa);
1747 goto out; 1748 goto out;
1749 }
1748 } 1750 }
1749 1751
1750 /* stop loop if key wrapped back to 0 */ 1752 /* stop loop if key wrapped back to 0 */
@@ -1760,6 +1762,71 @@ out:
1760 return NULL; 1762 return NULL;
1761} 1763}
1762 1764
1765/* Caller must hold RTNL */
1766void fib_table_flush_external(struct fib_table *tb)
1767{
1768 struct trie *t = (struct trie *)tb->tb_data;
1769 struct key_vector *pn = t->kv;
1770 unsigned long cindex = 1;
1771 struct hlist_node *tmp;
1772 struct fib_alias *fa;
1773
1774 /* walk trie in reverse order */
1775 for (;;) {
1776 unsigned char slen = 0;
1777 struct key_vector *n;
1778
1779 if (!(cindex--)) {
1780 t_key pkey = pn->key;
1781
1782 /* cannot resize the trie vector */
1783 if (IS_TRIE(pn))
1784 break;
1785
1786 /* resize completed node */
1787 pn = resize(t, pn);
1788 cindex = get_index(pkey, pn);
1789
1790 continue;
1791 }
1792
1793 /* grab the next available node */
1794 n = get_child(pn, cindex);
1795 if (!n)
1796 continue;
1797
1798 if (IS_TNODE(n)) {
1799 /* record pn and cindex for leaf walking */
1800 pn = n;
1801 cindex = 1ul << n->bits;
1802
1803 continue;
1804 }
1805
1806 hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) {
1807 /* if alias was cloned to local then we just
1808 * need to remove the local copy from main
1809 */
1810 if (tb->tb_id != fa->tb_id) {
1811 hlist_del_rcu(&fa->fa_list);
1812 alias_free_mem_rcu(fa);
1813 continue;
1814 }
1815
1816 /* record local slen */
1817 slen = fa->fa_slen;
1818 }
1819
1820 /* update leaf slen */
1821 n->slen = slen;
1822
1823 if (hlist_empty(&n->leaf)) {
1824 put_child_root(pn, n->key, NULL);
1825 node_free(n);
1826 }
1827 }
1828}
1829
1763/* Caller must hold RTNL. */ 1830/* Caller must hold RTNL. */
1764int fib_table_flush(struct net *net, struct fib_table *tb) 1831int fib_table_flush(struct net *net, struct fib_table *tb)
1765{ 1832{
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 606cc3e85d2b..15db786d50ed 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -162,7 +162,7 @@ static int unsolicited_report_interval(struct in_device *in_dev)
162} 162}
163 163
164static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im); 164static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im);
165static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr); 165static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im);
166static void igmpv3_clear_delrec(struct in_device *in_dev); 166static void igmpv3_clear_delrec(struct in_device *in_dev);
167static int sf_setstate(struct ip_mc_list *pmc); 167static int sf_setstate(struct ip_mc_list *pmc);
168static void sf_markstate(struct ip_mc_list *pmc); 168static void sf_markstate(struct ip_mc_list *pmc);
@@ -1130,10 +1130,15 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im)
1130 spin_unlock_bh(&in_dev->mc_tomb_lock); 1130 spin_unlock_bh(&in_dev->mc_tomb_lock);
1131} 1131}
1132 1132
1133static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr) 1133/*
1134 * restore ip_mc_list deleted records
1135 */
1136static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im)
1134{ 1137{
1135 struct ip_mc_list *pmc, *pmc_prev; 1138 struct ip_mc_list *pmc, *pmc_prev;
1136 struct ip_sf_list *psf, *psf_next; 1139 struct ip_sf_list *psf;
1140 struct net *net = dev_net(in_dev->dev);
1141 __be32 multiaddr = im->multiaddr;
1137 1142
1138 spin_lock_bh(&in_dev->mc_tomb_lock); 1143 spin_lock_bh(&in_dev->mc_tomb_lock);
1139 pmc_prev = NULL; 1144 pmc_prev = NULL;
@@ -1149,16 +1154,26 @@ static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr)
1149 in_dev->mc_tomb = pmc->next; 1154 in_dev->mc_tomb = pmc->next;
1150 } 1155 }
1151 spin_unlock_bh(&in_dev->mc_tomb_lock); 1156 spin_unlock_bh(&in_dev->mc_tomb_lock);
1157
1158 spin_lock_bh(&im->lock);
1152 if (pmc) { 1159 if (pmc) {
1153 for (psf = pmc->tomb; psf; psf = psf_next) { 1160 im->interface = pmc->interface;
1154 psf_next = psf->sf_next; 1161 im->crcount = in_dev->mr_qrv ?: net->ipv4.sysctl_igmp_qrv;
1155 kfree(psf); 1162 im->sfmode = pmc->sfmode;
1163 if (pmc->sfmode == MCAST_INCLUDE) {
1164 im->tomb = pmc->tomb;
1165 im->sources = pmc->sources;
1166 for (psf = im->sources; psf; psf = psf->sf_next)
1167 psf->sf_crcount = im->crcount;
1156 } 1168 }
1157 in_dev_put(pmc->interface); 1169 in_dev_put(pmc->interface);
1158 kfree(pmc);
1159 } 1170 }
1171 spin_unlock_bh(&im->lock);
1160} 1172}
1161 1173
1174/*
1175 * flush ip_mc_list deleted records
1176 */
1162static void igmpv3_clear_delrec(struct in_device *in_dev) 1177static void igmpv3_clear_delrec(struct in_device *in_dev)
1163{ 1178{
1164 struct ip_mc_list *pmc, *nextpmc; 1179 struct ip_mc_list *pmc, *nextpmc;
@@ -1366,7 +1381,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1366 ip_mc_hash_add(in_dev, im); 1381 ip_mc_hash_add(in_dev, im);
1367 1382
1368#ifdef CONFIG_IP_MULTICAST 1383#ifdef CONFIG_IP_MULTICAST
1369 igmpv3_del_delrec(in_dev, im->multiaddr); 1384 igmpv3_del_delrec(in_dev, im);
1370#endif 1385#endif
1371 igmp_group_added(im); 1386 igmp_group_added(im);
1372 if (!in_dev->dead) 1387 if (!in_dev->dead)
@@ -1626,8 +1641,12 @@ void ip_mc_remap(struct in_device *in_dev)
1626 1641
1627 ASSERT_RTNL(); 1642 ASSERT_RTNL();
1628 1643
1629 for_each_pmc_rtnl(in_dev, pmc) 1644 for_each_pmc_rtnl(in_dev, pmc) {
1645#ifdef CONFIG_IP_MULTICAST
1646 igmpv3_del_delrec(in_dev, pmc);
1647#endif
1630 igmp_group_added(pmc); 1648 igmp_group_added(pmc);
1649 }
1631} 1650}
1632 1651
1633/* Device going down */ 1652/* Device going down */
@@ -1648,7 +1667,6 @@ void ip_mc_down(struct in_device *in_dev)
1648 in_dev->mr_gq_running = 0; 1667 in_dev->mr_gq_running = 0;
1649 if (del_timer(&in_dev->mr_gq_timer)) 1668 if (del_timer(&in_dev->mr_gq_timer))
1650 __in_dev_put(in_dev); 1669 __in_dev_put(in_dev);
1651 igmpv3_clear_delrec(in_dev);
1652#endif 1670#endif
1653 1671
1654 ip_mc_dec_group(in_dev, IGMP_ALL_HOSTS); 1672 ip_mc_dec_group(in_dev, IGMP_ALL_HOSTS);
@@ -1688,8 +1706,12 @@ void ip_mc_up(struct in_device *in_dev)
1688#endif 1706#endif
1689 ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS); 1707 ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
1690 1708
1691 for_each_pmc_rtnl(in_dev, pmc) 1709 for_each_pmc_rtnl(in_dev, pmc) {
1710#ifdef CONFIG_IP_MULTICAST
1711 igmpv3_del_delrec(in_dev, pmc);
1712#endif
1692 igmp_group_added(pmc); 1713 igmp_group_added(pmc);
1714 }
1693} 1715}
1694 1716
1695/* 1717/*
@@ -1704,13 +1726,13 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
1704 1726
1705 /* Deactivate timers */ 1727 /* Deactivate timers */
1706 ip_mc_down(in_dev); 1728 ip_mc_down(in_dev);
1729#ifdef CONFIG_IP_MULTICAST
1730 igmpv3_clear_delrec(in_dev);
1731#endif
1707 1732
1708 while ((i = rtnl_dereference(in_dev->mc_list)) != NULL) { 1733 while ((i = rtnl_dereference(in_dev->mc_list)) != NULL) {
1709 in_dev->mc_list = i->next_rcu; 1734 in_dev->mc_list = i->next_rcu;
1710 in_dev->mc_count--; 1735 in_dev->mc_count--;
1711
1712 /* We've dropped the groups in ip_mc_down already */
1713 ip_mc_clear_src(i);
1714 ip_ma_put(i); 1736 ip_ma_put(i);
1715 } 1737 }
1716} 1738}
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 38905ec5f508..79c4817abc94 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -201,8 +201,10 @@ static void tcp_reinit_congestion_control(struct sock *sk,
201 icsk->icsk_ca_ops = ca; 201 icsk->icsk_ca_ops = ca;
202 icsk->icsk_ca_setsockopt = 1; 202 icsk->icsk_ca_setsockopt = 1;
203 203
204 if (sk->sk_state != TCP_CLOSE) 204 if (sk->sk_state != TCP_CLOSE) {
205 memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv));
205 tcp_init_congestion_control(sk); 206 tcp_init_congestion_control(sk);
207 }
206} 208}
207 209
208/* Manage refcounts on socket close. */ 210/* Manage refcounts on socket close. */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index b949770fdc08..b3b6bc5b9731 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1743,10 +1743,10 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1743 1743
1744 if (use_hash2) { 1744 if (use_hash2) {
1745 hash2_any = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum) & 1745 hash2_any = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum) &
1746 udp_table.mask; 1746 udptable->mask;
1747 hash2 = udp4_portaddr_hash(net, daddr, hnum) & udp_table.mask; 1747 hash2 = udp4_portaddr_hash(net, daddr, hnum) & udptable->mask;
1748start_lookup: 1748start_lookup:
1749 hslot = &udp_table.hash2[hash2]; 1749 hslot = &udptable->hash2[hash2];
1750 offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node); 1750 offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
1751 } 1751 }
1752 1752
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index d3c619eda051..1f49fb1101a1 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1034,6 +1034,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
1034 int mtu; 1034 int mtu;
1035 unsigned int psh_hlen = sizeof(struct ipv6hdr) + t->encap_hlen; 1035 unsigned int psh_hlen = sizeof(struct ipv6hdr) + t->encap_hlen;
1036 unsigned int max_headroom = psh_hlen; 1036 unsigned int max_headroom = psh_hlen;
1037 bool use_cache = false;
1037 u8 hop_limit; 1038 u8 hop_limit;
1038 int err = -1; 1039 int err = -1;
1039 1040
@@ -1066,7 +1067,15 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
1066 1067
1067 memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr)); 1068 memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));
1068 neigh_release(neigh); 1069 neigh_release(neigh);
1069 } else if (!fl6->flowi6_mark) 1070 } else if (!(t->parms.flags &
1071 (IP6_TNL_F_USE_ORIG_TCLASS | IP6_TNL_F_USE_ORIG_FWMARK))) {
1072 /* enable the cache only only if the routing decision does
1073 * not depend on the current inner header value
1074 */
1075 use_cache = true;
1076 }
1077
1078 if (use_cache)
1070 dst = dst_cache_get(&t->dst_cache); 1079 dst = dst_cache_get(&t->dst_cache);
1071 1080
1072 if (!ip6_tnl_xmit_ctl(t, &fl6->saddr, &fl6->daddr)) 1081 if (!ip6_tnl_xmit_ctl(t, &fl6->saddr, &fl6->daddr))
@@ -1150,7 +1159,7 @@ route_lookup:
1150 if (t->encap.type != TUNNEL_ENCAP_NONE) 1159 if (t->encap.type != TUNNEL_ENCAP_NONE)
1151 goto tx_err_dst_release; 1160 goto tx_err_dst_release;
1152 } else { 1161 } else {
1153 if (!fl6->flowi6_mark && ndst) 1162 if (use_cache && ndst)
1154 dst_cache_set_ip6(&t->dst_cache, ndst, &fl6->saddr); 1163 dst_cache_set_ip6(&t->dst_cache, ndst, &fl6->saddr);
1155 } 1164 }
1156 skb_dst_set(skb, dst); 1165 skb_dst_set(skb, dst);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8fd4d89380b8..ba25ec20806b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -691,10 +691,10 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
691 691
692 if (use_hash2) { 692 if (use_hash2) {
693 hash2_any = udp6_portaddr_hash(net, &in6addr_any, hnum) & 693 hash2_any = udp6_portaddr_hash(net, &in6addr_any, hnum) &
694 udp_table.mask; 694 udptable->mask;
695 hash2 = udp6_portaddr_hash(net, daddr, hnum) & udp_table.mask; 695 hash2 = udp6_portaddr_hash(net, daddr, hnum) & udptable->mask;
696start_lookup: 696start_lookup:
697 hslot = &udp_table.hash2[hash2]; 697 hslot = &udptable->hash2[hash2];
698 offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node); 698 offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
699 } 699 }
700 700
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index e2c6ae024565..5b90eb6c82c4 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -97,7 +97,7 @@ static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev)
97 unsigned int len = skb->len; 97 unsigned int len = skb->len;
98 int ret = l2tp_xmit_skb(session, skb, session->hdr_len); 98 int ret = l2tp_xmit_skb(session, skb, session->hdr_len);
99 99
100 if (likely(ret == NET_XMIT_SUCCESS)) { 100 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
101 atomic_long_add(len, &priv->tx_bytes); 101 atomic_long_add(len, &priv->tx_bytes);
102 atomic_long_inc(&priv->tx_packets); 102 atomic_long_inc(&priv->tx_packets);
103 } else { 103 } else {
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index fce25afb652a..982f6c44ea01 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -251,8 +251,6 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
251 int ret; 251 int ret;
252 int chk_addr_ret; 252 int chk_addr_ret;
253 253
254 if (!sock_flag(sk, SOCK_ZAPPED))
255 return -EINVAL;
256 if (addr_len < sizeof(struct sockaddr_l2tpip)) 254 if (addr_len < sizeof(struct sockaddr_l2tpip))
257 return -EINVAL; 255 return -EINVAL;
258 if (addr->l2tp_family != AF_INET) 256 if (addr->l2tp_family != AF_INET)
@@ -267,6 +265,9 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
267 read_unlock_bh(&l2tp_ip_lock); 265 read_unlock_bh(&l2tp_ip_lock);
268 266
269 lock_sock(sk); 267 lock_sock(sk);
268 if (!sock_flag(sk, SOCK_ZAPPED))
269 goto out;
270
270 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_l2tpip)) 271 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_l2tpip))
271 goto out; 272 goto out;
272 273
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 1cea54feab27..667ec909846f 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -269,8 +269,6 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
269 int addr_type; 269 int addr_type;
270 int err; 270 int err;
271 271
272 if (!sock_flag(sk, SOCK_ZAPPED))
273 return -EINVAL;
274 if (addr->l2tp_family != AF_INET6) 272 if (addr->l2tp_family != AF_INET6)
275 return -EINVAL; 273 return -EINVAL;
276 if (addr_len < sizeof(*addr)) 274 if (addr_len < sizeof(*addr))
@@ -296,6 +294,9 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
296 lock_sock(sk); 294 lock_sock(sk);
297 295
298 err = -EINVAL; 296 err = -EINVAL;
297 if (!sock_flag(sk, SOCK_ZAPPED))
298 goto out_unlock;
299
299 if (sk->sk_state != TCP_CLOSE) 300 if (sk->sk_state != TCP_CLOSE)
300 goto out_unlock; 301 goto out_unlock;
301 302
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 236d47e76ced..1711bae4abf2 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -688,7 +688,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending)
688 } 688 }
689 689
690 /* No need to do anything if the driver does all */ 690 /* No need to do anything if the driver does all */
691 if (!local->ops->set_tim) 691 if (ieee80211_hw_check(&local->hw, AP_LINK_PS))
692 return; 692 return;
693 693
694 if (sta->dead) 694 if (sta->dead)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 62ccaf6f585d..2c21b7039136 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1500,7 +1500,6 @@ static bool ieee80211_queue_skb(struct ieee80211_local *local,
1500 struct sta_info *sta, 1500 struct sta_info *sta,
1501 struct sk_buff *skb) 1501 struct sk_buff *skb)
1502{ 1502{
1503 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1504 struct fq *fq = &local->fq; 1503 struct fq *fq = &local->fq;
1505 struct ieee80211_vif *vif; 1504 struct ieee80211_vif *vif;
1506 struct txq_info *txqi; 1505 struct txq_info *txqi;
@@ -1525,8 +1524,6 @@ static bool ieee80211_queue_skb(struct ieee80211_local *local,
1525 if (!txqi) 1524 if (!txqi)
1526 return false; 1525 return false;
1527 1526
1528 info->control.vif = vif;
1529
1530 spin_lock_bh(&fq->lock); 1527 spin_lock_bh(&fq->lock);
1531 ieee80211_txq_enqueue(local, txqi, skb); 1528 ieee80211_txq_enqueue(local, txqi, skb);
1532 spin_unlock_bh(&fq->lock); 1529 spin_unlock_bh(&fq->lock);
@@ -3238,7 +3235,6 @@ static void ieee80211_xmit_fast_finish(struct ieee80211_sub_if_data *sdata,
3238 3235
3239 if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { 3236 if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
3240 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; 3237 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
3241 *ieee80211_get_qos_ctl(hdr) = tid;
3242 hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); 3238 hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid);
3243 } else { 3239 } else {
3244 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; 3240 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
@@ -3363,6 +3359,11 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3363 (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0); 3359 (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0);
3364 info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT; 3360 info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT;
3365 3361
3362 if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
3363 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
3364 *ieee80211_get_qos_ctl(hdr) = tid;
3365 }
3366
3366 __skb_queue_head_init(&tx.skbs); 3367 __skb_queue_head_init(&tx.skbs);
3367 3368
3368 tx.flags = IEEE80211_TX_UNICAST; 3369 tx.flags = IEEE80211_TX_UNICAST;
@@ -3451,6 +3452,11 @@ begin:
3451 goto begin; 3452 goto begin;
3452 } 3453 }
3453 3454
3455 if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
3456 info->flags |= IEEE80211_TX_CTL_AMPDU;
3457 else
3458 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
3459
3454 if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) { 3460 if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) {
3455 struct sta_info *sta = container_of(txq->sta, struct sta_info, 3461 struct sta_info *sta = container_of(txq->sta, struct sta_info,
3456 sta); 3462 sta);
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index ee715764a828..6832bf6ab69f 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -270,6 +270,22 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
270 vht_cap->vht_mcs.tx_mcs_map |= cpu_to_le16(peer_tx << i * 2); 270 vht_cap->vht_mcs.tx_mcs_map |= cpu_to_le16(peer_tx << i * 2);
271 } 271 }
272 272
273 /*
274 * This is a workaround for VHT-enabled STAs which break the spec
275 * and have the VHT-MCS Rx map filled in with value 3 for all eight
276 * spacial streams, an example is AR9462.
277 *
278 * As per spec, in section 22.1.1 Introduction to the VHT PHY
279 * A VHT STA shall support at least single spactial stream VHT-MCSs
280 * 0 to 7 (transmit and receive) in all supported channel widths.
281 */
282 if (vht_cap->vht_mcs.rx_mcs_map == cpu_to_le16(0xFFFF)) {
283 vht_cap->vht_supported = false;
284 sdata_info(sdata, "Ignoring VHT IE from %pM due to invalid rx_mcs_map\n",
285 sta->addr);
286 return;
287 }
288
273 /* finally set up the bandwidth */ 289 /* finally set up the bandwidth */
274 switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { 290 switch (vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
275 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ: 291 case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 2b2a7974e4bb..8e93d4afe5ea 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -112,7 +112,7 @@ static void tfilter_notify_chain(struct net *net, struct sk_buff *oskb,
112 112
113 for (it_chain = chain; (tp = rtnl_dereference(*it_chain)) != NULL; 113 for (it_chain = chain; (tp = rtnl_dereference(*it_chain)) != NULL;
114 it_chain = &tp->next) 114 it_chain = &tp->next)
115 tfilter_notify(net, oskb, n, tp, 0, event, false); 115 tfilter_notify(net, oskb, n, tp, n->nlmsg_flags, event, false);
116} 116}
117 117
118/* Select new prio value from the range, managed by kernel. */ 118/* Select new prio value from the range, managed by kernel. */
@@ -430,7 +430,8 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,
430 if (!skb) 430 if (!skb)
431 return -ENOBUFS; 431 return -ENOBUFS;
432 432
433 if (tcf_fill_node(net, skb, tp, fh, portid, n->nlmsg_seq, 0, event) <= 0) { 433 if (tcf_fill_node(net, skb, tp, fh, portid, n->nlmsg_seq,
434 n->nlmsg_flags, event) <= 0) {
434 kfree_skb(skb); 435 kfree_skb(skb);
435 return -EINVAL; 436 return -EINVAL;
436 } 437 }
diff --git a/net/socket.c b/net/socket.c
index f9e26c68c3cf..e2584c51aa1f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -341,8 +341,23 @@ static const struct xattr_handler sockfs_xattr_handler = {
341 .get = sockfs_xattr_get, 341 .get = sockfs_xattr_get,
342}; 342};
343 343
344static int sockfs_security_xattr_set(const struct xattr_handler *handler,
345 struct dentry *dentry, struct inode *inode,
346 const char *suffix, const void *value,
347 size_t size, int flags)
348{
349 /* Handled by LSM. */
350 return -EAGAIN;
351}
352
353static const struct xattr_handler sockfs_security_xattr_handler = {
354 .prefix = XATTR_SECURITY_PREFIX,
355 .set = sockfs_security_xattr_set,
356};
357
344static const struct xattr_handler *sockfs_xattr_handlers[] = { 358static const struct xattr_handler *sockfs_xattr_handlers[] = {
345 &sockfs_xattr_handler, 359 &sockfs_xattr_handler,
360 &sockfs_security_xattr_handler,
346 NULL 361 NULL
347}; 362};
348 363
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index c3f652395a80..3bc1d61694cb 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -1002,14 +1002,8 @@ static void svc_age_temp_xprts(unsigned long closure)
1002void svc_age_temp_xprts_now(struct svc_serv *serv, struct sockaddr *server_addr) 1002void svc_age_temp_xprts_now(struct svc_serv *serv, struct sockaddr *server_addr)
1003{ 1003{
1004 struct svc_xprt *xprt; 1004 struct svc_xprt *xprt;
1005 struct svc_sock *svsk;
1006 struct socket *sock;
1007 struct list_head *le, *next; 1005 struct list_head *le, *next;
1008 LIST_HEAD(to_be_closed); 1006 LIST_HEAD(to_be_closed);
1009 struct linger no_linger = {
1010 .l_onoff = 1,
1011 .l_linger = 0,
1012 };
1013 1007
1014 spin_lock_bh(&serv->sv_lock); 1008 spin_lock_bh(&serv->sv_lock);
1015 list_for_each_safe(le, next, &serv->sv_tempsocks) { 1009 list_for_each_safe(le, next, &serv->sv_tempsocks) {
@@ -1027,10 +1021,7 @@ void svc_age_temp_xprts_now(struct svc_serv *serv, struct sockaddr *server_addr)
1027 list_del_init(le); 1021 list_del_init(le);
1028 xprt = list_entry(le, struct svc_xprt, xpt_list); 1022 xprt = list_entry(le, struct svc_xprt, xpt_list);
1029 dprintk("svc_age_temp_xprts_now: closing %p\n", xprt); 1023 dprintk("svc_age_temp_xprts_now: closing %p\n", xprt);
1030 svsk = container_of(xprt, struct svc_sock, sk_xprt); 1024 xprt->xpt_ops->xpo_kill_temp_xprt(xprt);
1031 sock = svsk->sk_sock;
1032 kernel_setsockopt(sock, SOL_SOCKET, SO_LINGER,
1033 (char *)&no_linger, sizeof(no_linger));
1034 svc_close_xprt(xprt); 1025 svc_close_xprt(xprt);
1035 } 1026 }
1036} 1027}
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 78da4aee3543..135ec2c11b3b 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -451,6 +451,21 @@ static int svc_tcp_has_wspace(struct svc_xprt *xprt)
451 return !test_bit(SOCK_NOSPACE, &svsk->sk_sock->flags); 451 return !test_bit(SOCK_NOSPACE, &svsk->sk_sock->flags);
452} 452}
453 453
454static void svc_tcp_kill_temp_xprt(struct svc_xprt *xprt)
455{
456 struct svc_sock *svsk;
457 struct socket *sock;
458 struct linger no_linger = {
459 .l_onoff = 1,
460 .l_linger = 0,
461 };
462
463 svsk = container_of(xprt, struct svc_sock, sk_xprt);
464 sock = svsk->sk_sock;
465 kernel_setsockopt(sock, SOL_SOCKET, SO_LINGER,
466 (char *)&no_linger, sizeof(no_linger));
467}
468
454/* 469/*
455 * See net/ipv6/ip_sockglue.c : ip_cmsg_recv_pktinfo 470 * See net/ipv6/ip_sockglue.c : ip_cmsg_recv_pktinfo
456 */ 471 */
@@ -660,6 +675,10 @@ static struct svc_xprt *svc_udp_accept(struct svc_xprt *xprt)
660 return NULL; 675 return NULL;
661} 676}
662 677
678static void svc_udp_kill_temp_xprt(struct svc_xprt *xprt)
679{
680}
681
663static struct svc_xprt *svc_udp_create(struct svc_serv *serv, 682static struct svc_xprt *svc_udp_create(struct svc_serv *serv,
664 struct net *net, 683 struct net *net,
665 struct sockaddr *sa, int salen, 684 struct sockaddr *sa, int salen,
@@ -679,6 +698,7 @@ static struct svc_xprt_ops svc_udp_ops = {
679 .xpo_has_wspace = svc_udp_has_wspace, 698 .xpo_has_wspace = svc_udp_has_wspace,
680 .xpo_accept = svc_udp_accept, 699 .xpo_accept = svc_udp_accept,
681 .xpo_secure_port = svc_sock_secure_port, 700 .xpo_secure_port = svc_sock_secure_port,
701 .xpo_kill_temp_xprt = svc_udp_kill_temp_xprt,
682}; 702};
683 703
684static struct svc_xprt_class svc_udp_class = { 704static struct svc_xprt_class svc_udp_class = {
@@ -1254,6 +1274,7 @@ static struct svc_xprt_ops svc_tcp_ops = {
1254 .xpo_has_wspace = svc_tcp_has_wspace, 1274 .xpo_has_wspace = svc_tcp_has_wspace,
1255 .xpo_accept = svc_tcp_accept, 1275 .xpo_accept = svc_tcp_accept,
1256 .xpo_secure_port = svc_sock_secure_port, 1276 .xpo_secure_port = svc_sock_secure_port,
1277 .xpo_kill_temp_xprt = svc_tcp_kill_temp_xprt,
1257}; 1278};
1258 1279
1259static struct svc_xprt_class svc_tcp_class = { 1280static struct svc_xprt_class svc_tcp_class = {
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index 6864fb967038..1334de2715c2 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -67,6 +67,7 @@ static void svc_rdma_detach(struct svc_xprt *xprt);
67static void svc_rdma_free(struct svc_xprt *xprt); 67static void svc_rdma_free(struct svc_xprt *xprt);
68static int svc_rdma_has_wspace(struct svc_xprt *xprt); 68static int svc_rdma_has_wspace(struct svc_xprt *xprt);
69static int svc_rdma_secure_port(struct svc_rqst *); 69static int svc_rdma_secure_port(struct svc_rqst *);
70static void svc_rdma_kill_temp_xprt(struct svc_xprt *);
70 71
71static struct svc_xprt_ops svc_rdma_ops = { 72static struct svc_xprt_ops svc_rdma_ops = {
72 .xpo_create = svc_rdma_create, 73 .xpo_create = svc_rdma_create,
@@ -79,6 +80,7 @@ static struct svc_xprt_ops svc_rdma_ops = {
79 .xpo_has_wspace = svc_rdma_has_wspace, 80 .xpo_has_wspace = svc_rdma_has_wspace,
80 .xpo_accept = svc_rdma_accept, 81 .xpo_accept = svc_rdma_accept,
81 .xpo_secure_port = svc_rdma_secure_port, 82 .xpo_secure_port = svc_rdma_secure_port,
83 .xpo_kill_temp_xprt = svc_rdma_kill_temp_xprt,
82}; 84};
83 85
84struct svc_xprt_class svc_rdma_class = { 86struct svc_xprt_class svc_rdma_class = {
@@ -1317,6 +1319,10 @@ static int svc_rdma_secure_port(struct svc_rqst *rqstp)
1317 return 1; 1319 return 1;
1318} 1320}
1319 1321
1322static void svc_rdma_kill_temp_xprt(struct svc_xprt *xprt)
1323{
1324}
1325
1320int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr) 1326int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
1321{ 1327{
1322 struct ib_send_wr *bad_wr, *n_wr; 1328 struct ib_send_wr *bad_wr, *n_wr;
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 22d92f0ec5ac..4916d8fea328 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/socket.c: TIPC socket API 2 * net/tipc/socket.c: TIPC socket API
3 * 3 *
4 * Copyright (c) 2001-2007, 2012-2015, Ericsson AB 4 * Copyright (c) 2001-2007, 2012-2016, Ericsson AB
5 * Copyright (c) 2004-2008, 2010-2013, Wind River Systems 5 * Copyright (c) 2004-2008, 2010-2013, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -127,54 +127,8 @@ static const struct proto_ops packet_ops;
127static const struct proto_ops stream_ops; 127static const struct proto_ops stream_ops;
128static const struct proto_ops msg_ops; 128static const struct proto_ops msg_ops;
129static struct proto tipc_proto; 129static struct proto tipc_proto;
130
131static const struct rhashtable_params tsk_rht_params; 130static const struct rhashtable_params tsk_rht_params;
132 131
133/*
134 * Revised TIPC socket locking policy:
135 *
136 * Most socket operations take the standard socket lock when they start
137 * and hold it until they finish (or until they need to sleep). Acquiring
138 * this lock grants the owner exclusive access to the fields of the socket
139 * data structures, with the exception of the backlog queue. A few socket
140 * operations can be done without taking the socket lock because they only
141 * read socket information that never changes during the life of the socket.
142 *
143 * Socket operations may acquire the lock for the associated TIPC port if they
144 * need to perform an operation on the port. If any routine needs to acquire
145 * both the socket lock and the port lock it must take the socket lock first
146 * to avoid the risk of deadlock.
147 *
148 * The dispatcher handling incoming messages cannot grab the socket lock in
149 * the standard fashion, since invoked it runs at the BH level and cannot block.
150 * Instead, it checks to see if the socket lock is currently owned by someone,
151 * and either handles the message itself or adds it to the socket's backlog
152 * queue; in the latter case the queued message is processed once the process
153 * owning the socket lock releases it.
154 *
155 * NOTE: Releasing the socket lock while an operation is sleeping overcomes
156 * the problem of a blocked socket operation preventing any other operations
157 * from occurring. However, applications must be careful if they have
158 * multiple threads trying to send (or receive) on the same socket, as these
159 * operations might interfere with each other. For example, doing a connect
160 * and a receive at the same time might allow the receive to consume the
161 * ACK message meant for the connect. While additional work could be done
162 * to try and overcome this, it doesn't seem to be worthwhile at the present.
163 *
164 * NOTE: Releasing the socket lock while an operation is sleeping also ensures
165 * that another operation that must be performed in a non-blocking manner is
166 * not delayed for very long because the lock has already been taken.
167 *
168 * NOTE: This code assumes that certain fields of a port/socket pair are
169 * constant over its lifetime; such fields can be examined without taking
170 * the socket lock and/or port lock, and do not need to be re-read even
171 * after resuming processing after waiting. These fields include:
172 * - socket type
173 * - pointer to socket sk structure (aka tipc_sock structure)
174 * - pointer to port structure
175 * - port reference
176 */
177
178static u32 tsk_own_node(struct tipc_sock *tsk) 132static u32 tsk_own_node(struct tipc_sock *tsk)
179{ 133{
180 return msg_prevnode(&tsk->phdr); 134 return msg_prevnode(&tsk->phdr);
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 6a705d0ff889..1752d6b10ac4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2199,7 +2199,8 @@ out:
2199 * Sleep until more data has arrived. But check for races.. 2199 * Sleep until more data has arrived. But check for races..
2200 */ 2200 */
2201static long unix_stream_data_wait(struct sock *sk, long timeo, 2201static long unix_stream_data_wait(struct sock *sk, long timeo,
2202 struct sk_buff *last, unsigned int last_len) 2202 struct sk_buff *last, unsigned int last_len,
2203 bool freezable)
2203{ 2204{
2204 struct sk_buff *tail; 2205 struct sk_buff *tail;
2205 DEFINE_WAIT(wait); 2206 DEFINE_WAIT(wait);
@@ -2220,7 +2221,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo,
2220 2221
2221 sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); 2222 sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
2222 unix_state_unlock(sk); 2223 unix_state_unlock(sk);
2223 timeo = freezable_schedule_timeout(timeo); 2224 if (freezable)
2225 timeo = freezable_schedule_timeout(timeo);
2226 else
2227 timeo = schedule_timeout(timeo);
2224 unix_state_lock(sk); 2228 unix_state_lock(sk);
2225 2229
2226 if (sock_flag(sk, SOCK_DEAD)) 2230 if (sock_flag(sk, SOCK_DEAD))
@@ -2250,7 +2254,8 @@ struct unix_stream_read_state {
2250 unsigned int splice_flags; 2254 unsigned int splice_flags;
2251}; 2255};
2252 2256
2253static int unix_stream_read_generic(struct unix_stream_read_state *state) 2257static int unix_stream_read_generic(struct unix_stream_read_state *state,
2258 bool freezable)
2254{ 2259{
2255 struct scm_cookie scm; 2260 struct scm_cookie scm;
2256 struct socket *sock = state->socket; 2261 struct socket *sock = state->socket;
@@ -2330,7 +2335,7 @@ again:
2330 mutex_unlock(&u->iolock); 2335 mutex_unlock(&u->iolock);
2331 2336
2332 timeo = unix_stream_data_wait(sk, timeo, last, 2337 timeo = unix_stream_data_wait(sk, timeo, last,
2333 last_len); 2338 last_len, freezable);
2334 2339
2335 if (signal_pending(current)) { 2340 if (signal_pending(current)) {
2336 err = sock_intr_errno(timeo); 2341 err = sock_intr_errno(timeo);
@@ -2472,7 +2477,7 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
2472 .flags = flags 2477 .flags = flags
2473 }; 2478 };
2474 2479
2475 return unix_stream_read_generic(&state); 2480 return unix_stream_read_generic(&state, true);
2476} 2481}
2477 2482
2478static int unix_stream_splice_actor(struct sk_buff *skb, 2483static int unix_stream_splice_actor(struct sk_buff *skb,
@@ -2503,7 +2508,7 @@ static ssize_t unix_stream_splice_read(struct socket *sock, loff_t *ppos,
2503 flags & SPLICE_F_NONBLOCK) 2508 flags & SPLICE_F_NONBLOCK)
2504 state.flags = MSG_DONTWAIT; 2509 state.flags = MSG_DONTWAIT;
2505 2510
2506 return unix_stream_read_generic(&state); 2511 return unix_stream_read_generic(&state, false);
2507} 2512}
2508 2513
2509static int unix_shutdown(struct socket *sock, int mode) 2514static int unix_shutdown(struct socket *sock, int mode)
diff --git a/net/wireless/core.h b/net/wireless/core.h
index fb2fcd5581fe..ec5f33311769 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -71,6 +71,7 @@ struct cfg80211_registered_device {
71 struct list_head bss_list; 71 struct list_head bss_list;
72 struct rb_root bss_tree; 72 struct rb_root bss_tree;
73 u32 bss_generation; 73 u32 bss_generation;
74 u32 bss_entries;
74 struct cfg80211_scan_request *scan_req; /* protected by RTNL */ 75 struct cfg80211_scan_request *scan_req; /* protected by RTNL */
75 struct sk_buff *scan_msg; 76 struct sk_buff *scan_msg;
76 struct cfg80211_sched_scan_request __rcu *sched_scan_req; 77 struct cfg80211_sched_scan_request __rcu *sched_scan_req;
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index b5bd58d0f731..35ad69fd0838 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -57,6 +57,19 @@
57 * also linked into the probe response struct. 57 * also linked into the probe response struct.
58 */ 58 */
59 59
60/*
61 * Limit the number of BSS entries stored in mac80211. Each one is
62 * a bit over 4k at most, so this limits to roughly 4-5M of memory.
63 * If somebody wants to really attack this though, they'd likely
64 * use small beacons, and only one type of frame, limiting each of
65 * the entries to a much smaller size (in order to generate more
66 * entries in total, so overhead is bigger.)
67 */
68static int bss_entries_limit = 1000;
69module_param(bss_entries_limit, int, 0644);
70MODULE_PARM_DESC(bss_entries_limit,
71 "limit to number of scan BSS entries (per wiphy, default 1000)");
72
60#define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ) 73#define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ)
61 74
62static void bss_free(struct cfg80211_internal_bss *bss) 75static void bss_free(struct cfg80211_internal_bss *bss)
@@ -137,6 +150,10 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev,
137 150
138 list_del_init(&bss->list); 151 list_del_init(&bss->list);
139 rb_erase(&bss->rbn, &rdev->bss_tree); 152 rb_erase(&bss->rbn, &rdev->bss_tree);
153 rdev->bss_entries--;
154 WARN_ONCE((rdev->bss_entries == 0) ^ list_empty(&rdev->bss_list),
155 "rdev bss entries[%d]/list[empty:%d] corruption\n",
156 rdev->bss_entries, list_empty(&rdev->bss_list));
140 bss_ref_put(rdev, bss); 157 bss_ref_put(rdev, bss);
141 return true; 158 return true;
142} 159}
@@ -163,6 +180,40 @@ static void __cfg80211_bss_expire(struct cfg80211_registered_device *rdev,
163 rdev->bss_generation++; 180 rdev->bss_generation++;
164} 181}
165 182
183static bool cfg80211_bss_expire_oldest(struct cfg80211_registered_device *rdev)
184{
185 struct cfg80211_internal_bss *bss, *oldest = NULL;
186 bool ret;
187
188 lockdep_assert_held(&rdev->bss_lock);
189
190 list_for_each_entry(bss, &rdev->bss_list, list) {
191 if (atomic_read(&bss->hold))
192 continue;
193
194 if (!list_empty(&bss->hidden_list) &&
195 !bss->pub.hidden_beacon_bss)
196 continue;
197
198 if (oldest && time_before(oldest->ts, bss->ts))
199 continue;
200 oldest = bss;
201 }
202
203 if (WARN_ON(!oldest))
204 return false;
205
206 /*
207 * The callers make sure to increase rdev->bss_generation if anything
208 * gets removed (and a new entry added), so there's no need to also do
209 * it here.
210 */
211
212 ret = __cfg80211_unlink_bss(rdev, oldest);
213 WARN_ON(!ret);
214 return ret;
215}
216
166void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, 217void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
167 bool send_message) 218 bool send_message)
168{ 219{
@@ -689,6 +740,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,
689 const u8 *ie; 740 const u8 *ie;
690 int i, ssidlen; 741 int i, ssidlen;
691 u8 fold = 0; 742 u8 fold = 0;
743 u32 n_entries = 0;
692 744
693 ies = rcu_access_pointer(new->pub.beacon_ies); 745 ies = rcu_access_pointer(new->pub.beacon_ies);
694 if (WARN_ON(!ies)) 746 if (WARN_ON(!ies))
@@ -712,6 +764,12 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,
712 /* This is the bad part ... */ 764 /* This is the bad part ... */
713 765
714 list_for_each_entry(bss, &rdev->bss_list, list) { 766 list_for_each_entry(bss, &rdev->bss_list, list) {
767 /*
768 * we're iterating all the entries anyway, so take the
769 * opportunity to validate the list length accounting
770 */
771 n_entries++;
772
715 if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) 773 if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid))
716 continue; 774 continue;
717 if (bss->pub.channel != new->pub.channel) 775 if (bss->pub.channel != new->pub.channel)
@@ -740,6 +798,10 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,
740 new->pub.beacon_ies); 798 new->pub.beacon_ies);
741 } 799 }
742 800
801 WARN_ONCE(n_entries != rdev->bss_entries,
802 "rdev bss entries[%d]/list[len:%d] corruption\n",
803 rdev->bss_entries, n_entries);
804
743 return true; 805 return true;
744} 806}
745 807
@@ -894,7 +956,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
894 } 956 }
895 } 957 }
896 958
959 if (rdev->bss_entries >= bss_entries_limit &&
960 !cfg80211_bss_expire_oldest(rdev)) {
961 kfree(new);
962 goto drop;
963 }
964
897 list_add_tail(&new->list, &rdev->bss_list); 965 list_add_tail(&new->list, &rdev->bss_list);
966 rdev->bss_entries++;
898 rb_insert_bss(rdev, new); 967 rb_insert_bss(rdev, new);
899 found = new; 968 found = new;
900 } 969 }
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 88725f8eefad..e9d040d29846 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1159,7 +1159,8 @@ static u32 cfg80211_calculate_bitrate_vht(struct rate_info *rate)
1159 58500000, 1159 58500000,
1160 65000000, 1160 65000000,
1161 78000000, 1161 78000000,
1162 0, 1162 /* not in the spec, but some devices use this: */
1163 86500000,
1163 }, 1164 },
1164 { 13500000, 1165 { 13500000,
1165 27000000, 1166 27000000,