aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan.c2
-rw-r--r--net/8021q/vlan_dev.c71
-rw-r--r--net/bluetooth/hci_sysfs.c3
-rw-r--r--net/bluetooth/l2cap.c51
-rw-r--r--net/bluetooth/rfcomm/core.c41
-rw-r--r--net/bluetooth/rfcomm/sock.c41
-rw-r--r--net/bluetooth/sco.c41
-rw-r--r--net/can/bcm.c3
-rw-r--r--net/core/netpoll.c7
-rw-r--r--net/ieee802154/af_ieee802154.c3
-rw-r--r--net/ipv4/af_inet.c5
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_trie.c4
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ipmr.c11
-rw-r--r--net/ipv4/route.c24
-rw-r--r--net/ipv4/tcp.c1
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/ip6mr.c11
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c2
-rw-r--r--net/ipv6/route.c13
-rw-r--r--net/key/af_key.c8
-rw-r--r--net/mac80211/mesh_hwmp.c4
-rw-r--r--net/mac80211/tx.c6
-rw-r--r--net/mac80211/util.c18
-rw-r--r--net/netfilter/xt_hashlimit.c4
-rw-r--r--net/netfilter/xt_recent.c2
-rw-r--r--net/netlabel/netlabel_domainhash.c28
-rw-r--r--net/netlabel/netlabel_unlabeled.c66
-rw-r--r--net/netlink/af_netlink.c3
-rw-r--r--net/rxrpc/ar-accept.c6
-rw-r--r--net/sched/Kconfig5
-rw-r--r--net/sched/cls_cgroup.c36
-rw-r--r--net/socket.c4
-rw-r--r--net/sunrpc/xprtsock.c8
-rw-r--r--net/wireless/reg.c12
36 files changed, 370 insertions, 182 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index bd33f02013ec..7b13206185ba 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -378,6 +378,8 @@ static void vlan_transfer_features(struct net_device *dev,
378#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 378#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
379 vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid; 379 vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;
380#endif 380#endif
381 vlandev->real_num_tx_queues = dev->real_num_tx_queues;
382 BUG_ON(vlandev->real_num_tx_queues > vlandev->num_tx_queues);
381 383
382 if (old_features != vlandev->features) 384 if (old_features != vlandev->features)
383 netdev_features_change(vlandev); 385 netdev_features_change(vlandev);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 7f4d247237e4..f7d2fe431ee0 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -361,6 +361,14 @@ static netdev_tx_t vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb,
361 return ret; 361 return ret;
362} 362}
363 363
364static u16 vlan_dev_select_queue(struct net_device *dev, struct sk_buff *skb)
365{
366 struct net_device *rdev = vlan_dev_info(dev)->real_dev;
367 const struct net_device_ops *ops = rdev->netdev_ops;
368
369 return ops->ndo_select_queue(rdev, skb);
370}
371
364static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu) 372static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
365{ 373{
366 /* TODO: gotta make sure the underlying layer can handle it, 374 /* TODO: gotta make sure the underlying layer can handle it,
@@ -688,7 +696,8 @@ static const struct header_ops vlan_header_ops = {
688 .parse = eth_header_parse, 696 .parse = eth_header_parse,
689}; 697};
690 698
691static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops; 699static const struct net_device_ops vlan_netdev_ops, vlan_netdev_accel_ops,
700 vlan_netdev_ops_sq, vlan_netdev_accel_ops_sq;
692 701
693static int vlan_dev_init(struct net_device *dev) 702static int vlan_dev_init(struct net_device *dev)
694{ 703{
@@ -722,11 +731,17 @@ static int vlan_dev_init(struct net_device *dev)
722 if (real_dev->features & NETIF_F_HW_VLAN_TX) { 731 if (real_dev->features & NETIF_F_HW_VLAN_TX) {
723 dev->header_ops = real_dev->header_ops; 732 dev->header_ops = real_dev->header_ops;
724 dev->hard_header_len = real_dev->hard_header_len; 733 dev->hard_header_len = real_dev->hard_header_len;
725 dev->netdev_ops = &vlan_netdev_accel_ops; 734 if (real_dev->netdev_ops->ndo_select_queue)
735 dev->netdev_ops = &vlan_netdev_accel_ops_sq;
736 else
737 dev->netdev_ops = &vlan_netdev_accel_ops;
726 } else { 738 } else {
727 dev->header_ops = &vlan_header_ops; 739 dev->header_ops = &vlan_header_ops;
728 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN; 740 dev->hard_header_len = real_dev->hard_header_len + VLAN_HLEN;
729 dev->netdev_ops = &vlan_netdev_ops; 741 if (real_dev->netdev_ops->ndo_select_queue)
742 dev->netdev_ops = &vlan_netdev_ops_sq;
743 else
744 dev->netdev_ops = &vlan_netdev_ops;
730 } 745 }
731 746
732 if (is_vlan_dev(real_dev)) 747 if (is_vlan_dev(real_dev))
@@ -865,6 +880,56 @@ static const struct net_device_ops vlan_netdev_accel_ops = {
865#endif 880#endif
866}; 881};
867 882
883static const struct net_device_ops vlan_netdev_ops_sq = {
884 .ndo_select_queue = vlan_dev_select_queue,
885 .ndo_change_mtu = vlan_dev_change_mtu,
886 .ndo_init = vlan_dev_init,
887 .ndo_uninit = vlan_dev_uninit,
888 .ndo_open = vlan_dev_open,
889 .ndo_stop = vlan_dev_stop,
890 .ndo_start_xmit = vlan_dev_hard_start_xmit,
891 .ndo_validate_addr = eth_validate_addr,
892 .ndo_set_mac_address = vlan_dev_set_mac_address,
893 .ndo_set_rx_mode = vlan_dev_set_rx_mode,
894 .ndo_set_multicast_list = vlan_dev_set_rx_mode,
895 .ndo_change_rx_flags = vlan_dev_change_rx_flags,
896 .ndo_do_ioctl = vlan_dev_ioctl,
897 .ndo_neigh_setup = vlan_dev_neigh_setup,
898 .ndo_get_stats = vlan_dev_get_stats,
899#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
900 .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
901 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
902 .ndo_fcoe_enable = vlan_dev_fcoe_enable,
903 .ndo_fcoe_disable = vlan_dev_fcoe_disable,
904 .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
905#endif
906};
907
908static const struct net_device_ops vlan_netdev_accel_ops_sq = {
909 .ndo_select_queue = vlan_dev_select_queue,
910 .ndo_change_mtu = vlan_dev_change_mtu,
911 .ndo_init = vlan_dev_init,
912 .ndo_uninit = vlan_dev_uninit,
913 .ndo_open = vlan_dev_open,
914 .ndo_stop = vlan_dev_stop,
915 .ndo_start_xmit = vlan_dev_hwaccel_hard_start_xmit,
916 .ndo_validate_addr = eth_validate_addr,
917 .ndo_set_mac_address = vlan_dev_set_mac_address,
918 .ndo_set_rx_mode = vlan_dev_set_rx_mode,
919 .ndo_set_multicast_list = vlan_dev_set_rx_mode,
920 .ndo_change_rx_flags = vlan_dev_change_rx_flags,
921 .ndo_do_ioctl = vlan_dev_ioctl,
922 .ndo_neigh_setup = vlan_dev_neigh_setup,
923 .ndo_get_stats = vlan_dev_get_stats,
924#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
925 .ndo_fcoe_ddp_setup = vlan_dev_fcoe_ddp_setup,
926 .ndo_fcoe_ddp_done = vlan_dev_fcoe_ddp_done,
927 .ndo_fcoe_enable = vlan_dev_fcoe_enable,
928 .ndo_fcoe_disable = vlan_dev_fcoe_disable,
929 .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
930#endif
931};
932
868void vlan_setup(struct net_device *dev) 933void vlan_setup(struct net_device *dev)
869{ 934{
870 ether_setup(dev); 935 ether_setup(dev);
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index cafb55b0cea5..05fd125f74fe 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -8,8 +8,7 @@
8#include <net/bluetooth/bluetooth.h> 8#include <net/bluetooth/bluetooth.h>
9#include <net/bluetooth/hci_core.h> 9#include <net/bluetooth/hci_core.h>
10 10
11struct class *bt_class = NULL; 11static struct class *bt_class;
12EXPORT_SYMBOL_GPL(bt_class);
13 12
14struct dentry *bt_debugfs = NULL; 13struct dentry *bt_debugfs = NULL;
15EXPORT_SYMBOL_GPL(bt_debugfs); 14EXPORT_SYMBOL_GPL(bt_debugfs);
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 4db7ae2fe07d..99d68c34e4f1 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -40,6 +40,8 @@
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/list.h> 41#include <linux/list.h>
42#include <linux/device.h> 42#include <linux/device.h>
43#include <linux/debugfs.h>
44#include <linux/seq_file.h>
43#include <linux/uaccess.h> 45#include <linux/uaccess.h>
44#include <linux/crc16.h> 46#include <linux/crc16.h>
45#include <net/sock.h> 47#include <net/sock.h>
@@ -1000,7 +1002,8 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr, int al
1000 1002
1001 BT_DBG("sk %p", sk); 1003 BT_DBG("sk %p", sk);
1002 1004
1003 if (!addr || addr->sa_family != AF_BLUETOOTH) 1005 if (!addr || alen < sizeof(addr->sa_family) ||
1006 addr->sa_family != AF_BLUETOOTH)
1004 return -EINVAL; 1007 return -EINVAL;
1005 1008
1006 memset(&la, 0, sizeof(la)); 1009 memset(&la, 0, sizeof(la));
@@ -2830,6 +2833,11 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
2830 int len = cmd->len - sizeof(*rsp); 2833 int len = cmd->len - sizeof(*rsp);
2831 char req[64]; 2834 char req[64];
2832 2835
2836 if (len > sizeof(req) - sizeof(struct l2cap_conf_req)) {
2837 l2cap_send_disconn_req(conn, sk);
2838 goto done;
2839 }
2840
2833 /* throw out any old stored conf requests */ 2841 /* throw out any old stored conf requests */
2834 result = L2CAP_CONF_SUCCESS; 2842 result = L2CAP_CONF_SUCCESS;
2835 len = l2cap_parse_conf_rsp(sk, rsp->data, 2843 len = l2cap_parse_conf_rsp(sk, rsp->data,
@@ -3937,31 +3945,42 @@ drop:
3937 return 0; 3945 return 0;
3938} 3946}
3939 3947
3940static ssize_t l2cap_sysfs_show(struct class *dev, 3948static int l2cap_debugfs_show(struct seq_file *f, void *p)
3941 struct class_attribute *attr,
3942 char *buf)
3943{ 3949{
3944 struct sock *sk; 3950 struct sock *sk;
3945 struct hlist_node *node; 3951 struct hlist_node *node;
3946 char *str = buf;
3947 3952
3948 read_lock_bh(&l2cap_sk_list.lock); 3953 read_lock_bh(&l2cap_sk_list.lock);
3949 3954
3950 sk_for_each(sk, node, &l2cap_sk_list.head) { 3955 sk_for_each(sk, node, &l2cap_sk_list.head) {
3951 struct l2cap_pinfo *pi = l2cap_pi(sk); 3956 struct l2cap_pinfo *pi = l2cap_pi(sk);
3952 3957
3953 str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n", 3958 seq_printf(f, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d %d\n",
3954 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 3959 batostr(&bt_sk(sk)->src),
3955 sk->sk_state, __le16_to_cpu(pi->psm), pi->scid, 3960 batostr(&bt_sk(sk)->dst),
3956 pi->dcid, pi->imtu, pi->omtu, pi->sec_level); 3961 sk->sk_state, __le16_to_cpu(pi->psm),
3962 pi->scid, pi->dcid,
3963 pi->imtu, pi->omtu, pi->sec_level);
3957 } 3964 }
3958 3965
3959 read_unlock_bh(&l2cap_sk_list.lock); 3966 read_unlock_bh(&l2cap_sk_list.lock);
3960 3967
3961 return str - buf; 3968 return 0;
3969}
3970
3971static int l2cap_debugfs_open(struct inode *inode, struct file *file)
3972{
3973 return single_open(file, l2cap_debugfs_show, inode->i_private);
3962} 3974}
3963 3975
3964static CLASS_ATTR(l2cap, S_IRUGO, l2cap_sysfs_show, NULL); 3976static const struct file_operations l2cap_debugfs_fops = {
3977 .open = l2cap_debugfs_open,
3978 .read = seq_read,
3979 .llseek = seq_lseek,
3980 .release = single_release,
3981};
3982
3983static struct dentry *l2cap_debugfs;
3965 3984
3966static const struct proto_ops l2cap_sock_ops = { 3985static const struct proto_ops l2cap_sock_ops = {
3967 .family = PF_BLUETOOTH, 3986 .family = PF_BLUETOOTH,
@@ -4021,8 +4040,12 @@ static int __init l2cap_init(void)
4021 goto error; 4040 goto error;
4022 } 4041 }
4023 4042
4024 if (class_create_file(bt_class, &class_attr_l2cap) < 0) 4043 if (bt_debugfs) {
4025 BT_ERR("Failed to create L2CAP info file"); 4044 l2cap_debugfs = debugfs_create_file("l2cap", 0444,
4045 bt_debugfs, NULL, &l2cap_debugfs_fops);
4046 if (!l2cap_debugfs)
4047 BT_ERR("Failed to create L2CAP debug file");
4048 }
4026 4049
4027 BT_INFO("L2CAP ver %s", VERSION); 4050 BT_INFO("L2CAP ver %s", VERSION);
4028 BT_INFO("L2CAP socket layer initialized"); 4051 BT_INFO("L2CAP socket layer initialized");
@@ -4036,7 +4059,7 @@ error:
4036 4059
4037static void __exit l2cap_exit(void) 4060static void __exit l2cap_exit(void)
4038{ 4061{
4039 class_remove_file(bt_class, &class_attr_l2cap); 4062 debugfs_remove(l2cap_debugfs);
4040 4063
4041 if (bt_sock_unregister(BTPROTO_L2CAP) < 0) 4064 if (bt_sock_unregister(BTPROTO_L2CAP) < 0)
4042 BT_ERR("L2CAP socket unregistration failed"); 4065 BT_ERR("L2CAP socket unregistration failed");
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index db8a68e1a5ba..13f114e8b0f9 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -33,6 +33,8 @@
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/wait.h> 34#include <linux/wait.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/debugfs.h>
37#include <linux/seq_file.h>
36#include <linux/net.h> 38#include <linux/net.h>
37#include <linux/mutex.h> 39#include <linux/mutex.h>
38#include <linux/kthread.h> 40#include <linux/kthread.h>
@@ -2098,13 +2100,10 @@ static struct hci_cb rfcomm_cb = {
2098 .security_cfm = rfcomm_security_cfm 2100 .security_cfm = rfcomm_security_cfm
2099}; 2101};
2100 2102
2101static ssize_t rfcomm_dlc_sysfs_show(struct class *dev, 2103static int rfcomm_dlc_debugfs_show(struct seq_file *f, void *x)
2102 struct class_attribute *attr,
2103 char *buf)
2104{ 2104{
2105 struct rfcomm_session *s; 2105 struct rfcomm_session *s;
2106 struct list_head *pp, *p; 2106 struct list_head *pp, *p;
2107 char *str = buf;
2108 2107
2109 rfcomm_lock(); 2108 rfcomm_lock();
2110 2109
@@ -2114,18 +2113,32 @@ static ssize_t rfcomm_dlc_sysfs_show(struct class *dev,
2114 struct sock *sk = s->sock->sk; 2113 struct sock *sk = s->sock->sk;
2115 struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list); 2114 struct rfcomm_dlc *d = list_entry(pp, struct rfcomm_dlc, list);
2116 2115
2117 str += sprintf(str, "%s %s %ld %d %d %d %d\n", 2116 seq_printf(f, "%s %s %ld %d %d %d %d\n",
2118 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2117 batostr(&bt_sk(sk)->src),
2119 d->state, d->dlci, d->mtu, d->rx_credits, d->tx_credits); 2118 batostr(&bt_sk(sk)->dst),
2119 d->state, d->dlci, d->mtu,
2120 d->rx_credits, d->tx_credits);
2120 } 2121 }
2121 } 2122 }
2122 2123
2123 rfcomm_unlock(); 2124 rfcomm_unlock();
2124 2125
2125 return (str - buf); 2126 return 0;
2126} 2127}
2127 2128
2128static CLASS_ATTR(rfcomm_dlc, S_IRUGO, rfcomm_dlc_sysfs_show, NULL); 2129static int rfcomm_dlc_debugfs_open(struct inode *inode, struct file *file)
2130{
2131 return single_open(file, rfcomm_dlc_debugfs_show, inode->i_private);
2132}
2133
2134static const struct file_operations rfcomm_dlc_debugfs_fops = {
2135 .open = rfcomm_dlc_debugfs_open,
2136 .read = seq_read,
2137 .llseek = seq_lseek,
2138 .release = single_release,
2139};
2140
2141static struct dentry *rfcomm_dlc_debugfs;
2129 2142
2130/* ---- Initialization ---- */ 2143/* ---- Initialization ---- */
2131static int __init rfcomm_init(void) 2144static int __init rfcomm_init(void)
@@ -2142,8 +2155,12 @@ static int __init rfcomm_init(void)
2142 goto unregister; 2155 goto unregister;
2143 } 2156 }
2144 2157
2145 if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0) 2158 if (bt_debugfs) {
2146 BT_ERR("Failed to create RFCOMM info file"); 2159 rfcomm_dlc_debugfs = debugfs_create_file("rfcomm_dlc", 0444,
2160 bt_debugfs, NULL, &rfcomm_dlc_debugfs_fops);
2161 if (!rfcomm_dlc_debugfs)
2162 BT_ERR("Failed to create RFCOMM debug file");
2163 }
2147 2164
2148 err = rfcomm_init_ttys(); 2165 err = rfcomm_init_ttys();
2149 if (err < 0) 2166 if (err < 0)
@@ -2171,7 +2188,7 @@ unregister:
2171 2188
2172static void __exit rfcomm_exit(void) 2189static void __exit rfcomm_exit(void)
2173{ 2190{
2174 class_remove_file(bt_class, &class_attr_rfcomm_dlc); 2191 debugfs_remove(rfcomm_dlc_debugfs);
2175 2192
2176 hci_unregister_cb(&rfcomm_cb); 2193 hci_unregister_cb(&rfcomm_cb);
2177 2194
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index ca87d6ac6a20..8ed3c37684fa 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -40,6 +40,8 @@
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/list.h> 41#include <linux/list.h>
42#include <linux/device.h> 42#include <linux/device.h>
43#include <linux/debugfs.h>
44#include <linux/seq_file.h>
43#include <net/sock.h> 45#include <net/sock.h>
44 46
45#include <asm/system.h> 47#include <asm/system.h>
@@ -395,7 +397,8 @@ static int rfcomm_sock_connect(struct socket *sock, struct sockaddr *addr, int a
395 397
396 BT_DBG("sk %p", sk); 398 BT_DBG("sk %p", sk);
397 399
398 if (addr->sa_family != AF_BLUETOOTH || alen < sizeof(struct sockaddr_rc)) 400 if (alen < sizeof(struct sockaddr_rc) ||
401 addr->sa_family != AF_BLUETOOTH)
399 return -EINVAL; 402 return -EINVAL;
400 403
401 lock_sock(sk); 404 lock_sock(sk);
@@ -1061,28 +1064,38 @@ done:
1061 return result; 1064 return result;
1062} 1065}
1063 1066
1064static ssize_t rfcomm_sock_sysfs_show(struct class *dev, 1067static int rfcomm_sock_debugfs_show(struct seq_file *f, void *p)
1065 struct class_attribute *attr,
1066 char *buf)
1067{ 1068{
1068 struct sock *sk; 1069 struct sock *sk;
1069 struct hlist_node *node; 1070 struct hlist_node *node;
1070 char *str = buf;
1071 1071
1072 read_lock_bh(&rfcomm_sk_list.lock); 1072 read_lock_bh(&rfcomm_sk_list.lock);
1073 1073
1074 sk_for_each(sk, node, &rfcomm_sk_list.head) { 1074 sk_for_each(sk, node, &rfcomm_sk_list.head) {
1075 str += sprintf(str, "%s %s %d %d\n", 1075 seq_printf(f, "%s %s %d %d\n",
1076 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 1076 batostr(&bt_sk(sk)->src),
1077 batostr(&bt_sk(sk)->dst),
1077 sk->sk_state, rfcomm_pi(sk)->channel); 1078 sk->sk_state, rfcomm_pi(sk)->channel);
1078 } 1079 }
1079 1080
1080 read_unlock_bh(&rfcomm_sk_list.lock); 1081 read_unlock_bh(&rfcomm_sk_list.lock);
1081 1082
1082 return (str - buf); 1083 return 0;
1083} 1084}
1084 1085
1085static CLASS_ATTR(rfcomm, S_IRUGO, rfcomm_sock_sysfs_show, NULL); 1086static int rfcomm_sock_debugfs_open(struct inode *inode, struct file *file)
1087{
1088 return single_open(file, rfcomm_sock_debugfs_show, inode->i_private);
1089}
1090
1091static const struct file_operations rfcomm_sock_debugfs_fops = {
1092 .open = rfcomm_sock_debugfs_open,
1093 .read = seq_read,
1094 .llseek = seq_lseek,
1095 .release = single_release,
1096};
1097
1098static struct dentry *rfcomm_sock_debugfs;
1086 1099
1087static const struct proto_ops rfcomm_sock_ops = { 1100static const struct proto_ops rfcomm_sock_ops = {
1088 .family = PF_BLUETOOTH, 1101 .family = PF_BLUETOOTH,
@@ -1122,8 +1135,12 @@ int __init rfcomm_init_sockets(void)
1122 if (err < 0) 1135 if (err < 0)
1123 goto error; 1136 goto error;
1124 1137
1125 if (class_create_file(bt_class, &class_attr_rfcomm) < 0) 1138 if (bt_debugfs) {
1126 BT_ERR("Failed to create RFCOMM info file"); 1139 rfcomm_sock_debugfs = debugfs_create_file("rfcomm", 0444,
1140 bt_debugfs, NULL, &rfcomm_sock_debugfs_fops);
1141 if (!rfcomm_sock_debugfs)
1142 BT_ERR("Failed to create RFCOMM debug file");
1143 }
1127 1144
1128 BT_INFO("RFCOMM socket layer initialized"); 1145 BT_INFO("RFCOMM socket layer initialized");
1129 1146
@@ -1137,7 +1154,7 @@ error:
1137 1154
1138void rfcomm_cleanup_sockets(void) 1155void rfcomm_cleanup_sockets(void)
1139{ 1156{
1140 class_remove_file(bt_class, &class_attr_rfcomm); 1157 debugfs_remove(rfcomm_sock_debugfs);
1141 1158
1142 if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) 1159 if (bt_sock_unregister(BTPROTO_RFCOMM) < 0)
1143 BT_ERR("RFCOMM socket layer unregistration failed"); 1160 BT_ERR("RFCOMM socket layer unregistration failed");
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index f93b939539bc..ca6b2ad1c3fc 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -38,6 +38,8 @@
38#include <linux/socket.h> 38#include <linux/socket.h>
39#include <linux/skbuff.h> 39#include <linux/skbuff.h>
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/debugfs.h>
42#include <linux/seq_file.h>
41#include <linux/list.h> 43#include <linux/list.h>
42#include <net/sock.h> 44#include <net/sock.h>
43 45
@@ -497,7 +499,8 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen
497 499
498 BT_DBG("sk %p", sk); 500 BT_DBG("sk %p", sk);
499 501
500 if (addr->sa_family != AF_BLUETOOTH || alen < sizeof(struct sockaddr_sco)) 502 if (alen < sizeof(struct sockaddr_sco) ||
503 addr->sa_family != AF_BLUETOOTH)
501 return -EINVAL; 504 return -EINVAL;
502 505
503 if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND) 506 if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND)
@@ -953,28 +956,36 @@ drop:
953 return 0; 956 return 0;
954} 957}
955 958
956static ssize_t sco_sysfs_show(struct class *dev, 959static int sco_debugfs_show(struct seq_file *f, void *p)
957 struct class_attribute *attr,
958 char *buf)
959{ 960{
960 struct sock *sk; 961 struct sock *sk;
961 struct hlist_node *node; 962 struct hlist_node *node;
962 char *str = buf;
963 963
964 read_lock_bh(&sco_sk_list.lock); 964 read_lock_bh(&sco_sk_list.lock);
965 965
966 sk_for_each(sk, node, &sco_sk_list.head) { 966 sk_for_each(sk, node, &sco_sk_list.head) {
967 str += sprintf(str, "%s %s %d\n", 967 seq_printf(f, "%s %s %d\n", batostr(&bt_sk(sk)->src),
968 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 968 batostr(&bt_sk(sk)->dst), sk->sk_state);
969 sk->sk_state);
970 } 969 }
971 970
972 read_unlock_bh(&sco_sk_list.lock); 971 read_unlock_bh(&sco_sk_list.lock);
973 972
974 return (str - buf); 973 return 0;
975} 974}
976 975
977static CLASS_ATTR(sco, S_IRUGO, sco_sysfs_show, NULL); 976static int sco_debugfs_open(struct inode *inode, struct file *file)
977{
978 return single_open(file, sco_debugfs_show, inode->i_private);
979}
980
981static const struct file_operations sco_debugfs_fops = {
982 .open = sco_debugfs_open,
983 .read = seq_read,
984 .llseek = seq_lseek,
985 .release = single_release,
986};
987
988static struct dentry *sco_debugfs;
978 989
979static const struct proto_ops sco_sock_ops = { 990static const struct proto_ops sco_sock_ops = {
980 .family = PF_BLUETOOTH, 991 .family = PF_BLUETOOTH,
@@ -1032,8 +1043,12 @@ static int __init sco_init(void)
1032 goto error; 1043 goto error;
1033 } 1044 }
1034 1045
1035 if (class_create_file(bt_class, &class_attr_sco) < 0) 1046 if (bt_debugfs) {
1036 BT_ERR("Failed to create SCO info file"); 1047 sco_debugfs = debugfs_create_file("sco", 0444,
1048 bt_debugfs, NULL, &sco_debugfs_fops);
1049 if (!sco_debugfs)
1050 BT_ERR("Failed to create SCO debug file");
1051 }
1037 1052
1038 BT_INFO("SCO (Voice Link) ver %s", VERSION); 1053 BT_INFO("SCO (Voice Link) ver %s", VERSION);
1039 BT_INFO("SCO socket layer initialized"); 1054 BT_INFO("SCO socket layer initialized");
@@ -1047,7 +1062,7 @@ error:
1047 1062
1048static void __exit sco_exit(void) 1063static void __exit sco_exit(void)
1049{ 1064{
1050 class_remove_file(bt_class, &class_attr_sco); 1065 debugfs_remove(sco_debugfs);
1051 1066
1052 if (bt_sock_unregister(BTPROTO_SCO) < 0) 1067 if (bt_sock_unregister(BTPROTO_SCO) < 0)
1053 BT_ERR("SCO socket unregistration failed"); 1068 BT_ERR("SCO socket unregistration failed");
diff --git a/net/can/bcm.c b/net/can/bcm.c
index e32af52238a2..629ad1debe81 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1478,6 +1478,9 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
1478 struct sock *sk = sock->sk; 1478 struct sock *sk = sock->sk;
1479 struct bcm_sock *bo = bcm_sk(sk); 1479 struct bcm_sock *bo = bcm_sk(sk);
1480 1480
1481 if (len < sizeof(*addr))
1482 return -EINVAL;
1483
1481 if (bo->bound) 1484 if (bo->bound)
1482 return -EISCONN; 1485 return -EISCONN;
1483 1486
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index d4ec38fa64e6..6f9206b36dc2 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -614,7 +614,7 @@ void netpoll_print_options(struct netpoll *np)
614 np->name, np->local_port); 614 np->name, np->local_port);
615 printk(KERN_INFO "%s: local IP %pI4\n", 615 printk(KERN_INFO "%s: local IP %pI4\n",
616 np->name, &np->local_ip); 616 np->name, &np->local_ip);
617 printk(KERN_INFO "%s: interface %s\n", 617 printk(KERN_INFO "%s: interface '%s'\n",
618 np->name, np->dev_name); 618 np->name, np->dev_name);
619 printk(KERN_INFO "%s: remote port %d\n", 619 printk(KERN_INFO "%s: remote port %d\n",
620 np->name, np->remote_port); 620 np->name, np->remote_port);
@@ -661,6 +661,9 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
661 if ((delim = strchr(cur, '@')) == NULL) 661 if ((delim = strchr(cur, '@')) == NULL)
662 goto parse_failed; 662 goto parse_failed;
663 *delim = 0; 663 *delim = 0;
664 if (*cur == ' ' || *cur == '\t')
665 printk(KERN_INFO "%s: warning: whitespace"
666 "is not allowed\n", np->name);
664 np->remote_port = simple_strtol(cur, NULL, 10); 667 np->remote_port = simple_strtol(cur, NULL, 10);
665 cur = delim; 668 cur = delim;
666 } 669 }
@@ -708,7 +711,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
708 return 0; 711 return 0;
709 712
710 parse_failed: 713 parse_failed:
711 printk(KERN_INFO "%s: couldn't parse config at %s!\n", 714 printk(KERN_INFO "%s: couldn't parse config at '%s'!\n",
712 np->name, cur); 715 np->name, cur);
713 return -1; 716 return -1;
714} 717}
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index bad1c49fd960..01beb6c11205 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -126,6 +126,9 @@ static int ieee802154_sock_connect(struct socket *sock, struct sockaddr *uaddr,
126{ 126{
127 struct sock *sk = sock->sk; 127 struct sock *sk = sock->sk;
128 128
129 if (addr_len < sizeof(uaddr->sa_family))
130 return -EINVAL;
131
129 if (uaddr->sa_family == AF_UNSPEC) 132 if (uaddr->sa_family == AF_UNSPEC)
130 return sk->sk_prot->disconnect(sk, flags); 133 return sk->sk_prot->disconnect(sk, flags);
131 134
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 55e11906a73a..b5924f178812 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -530,6 +530,8 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr * uaddr,
530{ 530{
531 struct sock *sk = sock->sk; 531 struct sock *sk = sock->sk;
532 532
533 if (addr_len < sizeof(uaddr->sa_family))
534 return -EINVAL;
533 if (uaddr->sa_family == AF_UNSPEC) 535 if (uaddr->sa_family == AF_UNSPEC)
534 return sk->sk_prot->disconnect(sk, flags); 536 return sk->sk_prot->disconnect(sk, flags);
535 537
@@ -573,6 +575,9 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
573 int err; 575 int err;
574 long timeo; 576 long timeo;
575 577
578 if (addr_len < sizeof(uaddr->sa_family))
579 return -EINVAL;
580
576 lock_sock(sk); 581 lock_sock(sk);
577 582
578 if (uaddr->sa_family == AF_UNSPEC) { 583 if (uaddr->sa_family == AF_UNSPEC) {
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index c75320ef95c2..d009c6a5d9ad 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1194,7 +1194,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
1194 hlist_for_each_entry_rcu(dev, node, head, index_hlist) { 1194 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
1195 if (idx < s_idx) 1195 if (idx < s_idx)
1196 goto cont; 1196 goto cont;
1197 if (idx > s_idx) 1197 if (h > s_h || idx > s_idx)
1198 s_ip_idx = 0; 1198 s_ip_idx = 0;
1199 in_dev = __in_dev_get_rcu(dev); 1199 in_dev = __in_dev_get_rcu(dev);
1200 if (!in_dev) 1200 if (!in_dev)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index af5d89792860..01ef8ba9025c 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -961,7 +961,9 @@ fib_find_node(struct trie *t, u32 key)
961 struct node *n; 961 struct node *n;
962 962
963 pos = 0; 963 pos = 0;
964 n = rcu_dereference(t->trie); 964 n = rcu_dereference_check(t->trie,
965 rcu_read_lock_held() ||
966 lockdep_rtnl_is_held());
965 967
966 while (n != NULL && NODE_TYPE(n) == T_TNODE) { 968 while (n != NULL && NODE_TYPE(n) == T_TNODE) {
967 tn = (struct tnode *) n; 969 tn = (struct tnode *) n;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index f47c9f76754b..f78402d097b3 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -810,11 +810,13 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
810 tunnel->err_count = 0; 810 tunnel->err_count = 0;
811 } 811 }
812 812
813 max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen; 813 max_headroom = LL_RESERVED_SPACE(tdev) + gre_hlen + rt->u.dst.header_len;
814 814
815 if (skb_headroom(skb) < max_headroom || skb_shared(skb)|| 815 if (skb_headroom(skb) < max_headroom || skb_shared(skb)||
816 (skb_cloned(skb) && !skb_clone_writable(skb, 0))) { 816 (skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
817 struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom); 817 struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
818 if (max_headroom > dev->needed_headroom)
819 dev->needed_headroom = max_headroom;
818 if (!new_skb) { 820 if (!new_skb) {
819 ip_rt_put(rt); 821 ip_rt_put(rt);
820 txq->tx_dropped++; 822 txq->tx_dropped++;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 0b9d03c54dc3..d0a6092a67be 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1616,17 +1616,20 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
1616 int ct; 1616 int ct;
1617 struct rtnexthop *nhp; 1617 struct rtnexthop *nhp;
1618 struct net *net = mfc_net(c); 1618 struct net *net = mfc_net(c);
1619 struct net_device *dev = net->ipv4.vif_table[c->mfc_parent].dev;
1620 u8 *b = skb_tail_pointer(skb); 1619 u8 *b = skb_tail_pointer(skb);
1621 struct rtattr *mp_head; 1620 struct rtattr *mp_head;
1622 1621
1623 if (dev) 1622 /* If cache is unresolved, don't try to parse IIF and OIF */
1624 RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); 1623 if (c->mfc_parent > MAXVIFS)
1624 return -ENOENT;
1625
1626 if (VIF_EXISTS(net, c->mfc_parent))
1627 RTA_PUT(skb, RTA_IIF, 4, &net->ipv4.vif_table[c->mfc_parent].dev->ifindex);
1625 1628
1626 mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); 1629 mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0));
1627 1630
1628 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { 1631 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) {
1629 if (c->mfc_un.res.ttls[ct] < 255) { 1632 if (VIF_EXISTS(net, ct) && c->mfc_un.res.ttls[ct] < 255) {
1630 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) 1633 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4))
1631 goto rtattr_failure; 1634 goto rtattr_failure;
1632 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); 1635 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp)));
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 32d396196df8..d413b57be9b3 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1097,7 +1097,7 @@ static int slow_chain_length(const struct rtable *head)
1097} 1097}
1098 1098
1099static int rt_intern_hash(unsigned hash, struct rtable *rt, 1099static int rt_intern_hash(unsigned hash, struct rtable *rt,
1100 struct rtable **rp, struct sk_buff *skb) 1100 struct rtable **rp, struct sk_buff *skb, int ifindex)
1101{ 1101{
1102 struct rtable *rth, **rthp; 1102 struct rtable *rth, **rthp;
1103 unsigned long now; 1103 unsigned long now;
@@ -1212,11 +1212,16 @@ restart:
1212 slow_chain_length(rt_hash_table[hash].chain) > rt_chain_length_max) { 1212 slow_chain_length(rt_hash_table[hash].chain) > rt_chain_length_max) {
1213 struct net *net = dev_net(rt->u.dst.dev); 1213 struct net *net = dev_net(rt->u.dst.dev);
1214 int num = ++net->ipv4.current_rt_cache_rebuild_count; 1214 int num = ++net->ipv4.current_rt_cache_rebuild_count;
1215 if (!rt_caching(dev_net(rt->u.dst.dev))) { 1215 if (!rt_caching(net)) {
1216 printk(KERN_WARNING "%s: %d rebuilds is over limit, route caching disabled\n", 1216 printk(KERN_WARNING "%s: %d rebuilds is over limit, route caching disabled\n",
1217 rt->u.dst.dev->name, num); 1217 rt->u.dst.dev->name, num);
1218 } 1218 }
1219 rt_emergency_hash_rebuild(dev_net(rt->u.dst.dev)); 1219 rt_emergency_hash_rebuild(net);
1220 spin_unlock_bh(rt_hash_lock_addr(hash));
1221
1222 hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
1223 ifindex, rt_genid(net));
1224 goto restart;
1220 } 1225 }
1221 } 1226 }
1222 1227
@@ -1477,7 +1482,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1477 &netevent); 1482 &netevent);
1478 1483
1479 rt_del(hash, rth); 1484 rt_del(hash, rth);
1480 if (!rt_intern_hash(hash, rt, &rt, NULL)) 1485 if (!rt_intern_hash(hash, rt, &rt, NULL, rt->fl.oif))
1481 ip_rt_put(rt); 1486 ip_rt_put(rt);
1482 goto do_next; 1487 goto do_next;
1483 } 1488 }
@@ -1510,7 +1515,8 @@ static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
1510 ip_rt_put(rt); 1515 ip_rt_put(rt);
1511 ret = NULL; 1516 ret = NULL;
1512 } else if ((rt->rt_flags & RTCF_REDIRECTED) || 1517 } else if ((rt->rt_flags & RTCF_REDIRECTED) ||
1513 rt->u.dst.expires) { 1518 (rt->u.dst.expires &&
1519 time_after_eq(jiffies, rt->u.dst.expires))) {
1514 unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src, 1520 unsigned hash = rt_hash(rt->fl.fl4_dst, rt->fl.fl4_src,
1515 rt->fl.oif, 1521 rt->fl.oif,
1516 rt_genid(dev_net(dst->dev))); 1522 rt_genid(dev_net(dst->dev)));
@@ -1930,7 +1936,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1930 1936
1931 in_dev_put(in_dev); 1937 in_dev_put(in_dev);
1932 hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); 1938 hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev)));
1933 return rt_intern_hash(hash, rth, NULL, skb); 1939 return rt_intern_hash(hash, rth, NULL, skb, dev->ifindex);
1934 1940
1935e_nobufs: 1941e_nobufs:
1936 in_dev_put(in_dev); 1942 in_dev_put(in_dev);
@@ -2097,7 +2103,7 @@ static int ip_mkroute_input(struct sk_buff *skb,
2097 /* put it into the cache */ 2103 /* put it into the cache */
2098 hash = rt_hash(daddr, saddr, fl->iif, 2104 hash = rt_hash(daddr, saddr, fl->iif,
2099 rt_genid(dev_net(rth->u.dst.dev))); 2105 rt_genid(dev_net(rth->u.dst.dev)));
2100 return rt_intern_hash(hash, rth, NULL, skb); 2106 return rt_intern_hash(hash, rth, NULL, skb, fl->iif);
2101} 2107}
2102 2108
2103/* 2109/*
@@ -2254,7 +2260,7 @@ local_input:
2254 } 2260 }
2255 rth->rt_type = res.type; 2261 rth->rt_type = res.type;
2256 hash = rt_hash(daddr, saddr, fl.iif, rt_genid(net)); 2262 hash = rt_hash(daddr, saddr, fl.iif, rt_genid(net));
2257 err = rt_intern_hash(hash, rth, NULL, skb); 2263 err = rt_intern_hash(hash, rth, NULL, skb, fl.iif);
2258 goto done; 2264 goto done;
2259 2265
2260no_route: 2266no_route:
@@ -2501,7 +2507,7 @@ static int ip_mkroute_output(struct rtable **rp,
2501 if (err == 0) { 2507 if (err == 0) {
2502 hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif, 2508 hash = rt_hash(oldflp->fl4_dst, oldflp->fl4_src, oldflp->oif,
2503 rt_genid(dev_net(dev_out))); 2509 rt_genid(dev_net(dev_out)));
2504 err = rt_intern_hash(hash, rth, rp, NULL); 2510 err = rt_intern_hash(hash, rth, rp, NULL, oldflp->oif);
2505 } 2511 }
2506 2512
2507 return err; 2513 return err;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6afb6d8662b2..2c75f891914e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1368,6 +1368,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1368 sk_eat_skb(sk, skb, 0); 1368 sk_eat_skb(sk, skb, 0);
1369 if (!desc->count) 1369 if (!desc->count)
1370 break; 1370 break;
1371 tp->copied_seq = seq;
1371 } 1372 }
1372 tp->copied_seq = seq; 1373 tp->copied_seq = seq;
1373 1374
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 21b4c9e1a682..1c58b99a54a4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3607,7 +3607,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
3607 hlist_for_each_entry_rcu(dev, node, head, index_hlist) { 3607 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
3608 if (idx < s_idx) 3608 if (idx < s_idx)
3609 goto cont; 3609 goto cont;
3610 if (idx > s_idx) 3610 if (h > s_h || idx > s_idx)
3611 s_ip_idx = 0; 3611 s_ip_idx = 0;
3612 ip_idx = 0; 3612 ip_idx = 0;
3613 idev = __in6_dev_get(dev); 3613 idev = __in6_dev_get(dev);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 23e4ac0cc30e..27acfb58650a 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1695,17 +1695,20 @@ ip6mr_fill_mroute(struct sk_buff *skb, struct mfc6_cache *c, struct rtmsg *rtm)
1695 int ct; 1695 int ct;
1696 struct rtnexthop *nhp; 1696 struct rtnexthop *nhp;
1697 struct net *net = mfc6_net(c); 1697 struct net *net = mfc6_net(c);
1698 struct net_device *dev = net->ipv6.vif6_table[c->mf6c_parent].dev;
1699 u8 *b = skb_tail_pointer(skb); 1698 u8 *b = skb_tail_pointer(skb);
1700 struct rtattr *mp_head; 1699 struct rtattr *mp_head;
1701 1700
1702 if (dev) 1701 /* If cache is unresolved, don't try to parse IIF and OIF */
1703 RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex); 1702 if (c->mf6c_parent > MAXMIFS)
1703 return -ENOENT;
1704
1705 if (MIF_EXISTS(net, c->mf6c_parent))
1706 RTA_PUT(skb, RTA_IIF, 4, &net->ipv6.vif6_table[c->mf6c_parent].dev->ifindex);
1704 1707
1705 mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0)); 1708 mp_head = (struct rtattr *)skb_put(skb, RTA_LENGTH(0));
1706 1709
1707 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) { 1710 for (ct = c->mfc_un.res.minvif; ct < c->mfc_un.res.maxvif; ct++) {
1708 if (c->mfc_un.res.ttls[ct] < 255) { 1711 if (MIF_EXISTS(net, ct) && c->mfc_un.res.ttls[ct] < 255) {
1709 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4)) 1712 if (skb_tailroom(skb) < RTA_ALIGN(RTA_ALIGN(sizeof(*nhp)) + 4))
1710 goto rtattr_failure; 1713 goto rtattr_failure;
1711 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp))); 1714 nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp)));
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index aef31a29de9e..b9cf7cd61923 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -13,7 +13,7 @@ static const struct xt_table packet_raw = {
13 .valid_hooks = RAW_VALID_HOOKS, 13 .valid_hooks = RAW_VALID_HOOKS,
14 .me = THIS_MODULE, 14 .me = THIS_MODULE,
15 .af = NFPROTO_IPV6, 15 .af = NFPROTO_IPV6,
16 .priority = NF_IP6_PRI_FIRST, 16 .priority = NF_IP6_PRI_RAW,
17}; 17};
18 18
19/* The work comes in here from netfilter.c. */ 19/* The work comes in here from netfilter.c. */
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7fcb0e5d1213..0d7713c5c206 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -890,12 +890,17 @@ static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
890 struct rt6_info *rt = (struct rt6_info *) dst; 890 struct rt6_info *rt = (struct rt6_info *) dst;
891 891
892 if (rt) { 892 if (rt) {
893 if (rt->rt6i_flags & RTF_CACHE) 893 if (rt->rt6i_flags & RTF_CACHE) {
894 ip6_del_rt(rt); 894 if (rt6_check_expired(rt)) {
895 else 895 ip6_del_rt(rt);
896 dst = NULL;
897 }
898 } else {
896 dst_release(dst); 899 dst_release(dst);
900 dst = NULL;
901 }
897 } 902 }
898 return NULL; 903 return dst;
899} 904}
900 905
901static void ip6_link_failure(struct sk_buff *skb) 906static void ip6_link_failure(struct sk_buff *skb)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 368707882647..344145f23c34 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2129,10 +2129,9 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
2129 int err; 2129 int err;
2130 2130
2131 out_skb = pfkey_xfrm_policy2msg_prep(xp); 2131 out_skb = pfkey_xfrm_policy2msg_prep(xp);
2132 if (IS_ERR(out_skb)) { 2132 if (IS_ERR(out_skb))
2133 err = PTR_ERR(out_skb); 2133 return PTR_ERR(out_skb);
2134 goto out; 2134
2135 }
2136 err = pfkey_xfrm_policy2msg(out_skb, xp, dir); 2135 err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
2137 if (err < 0) 2136 if (err < 0)
2138 return err; 2137 return err;
@@ -2148,7 +2147,6 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
2148 out_hdr->sadb_msg_seq = c->seq; 2147 out_hdr->sadb_msg_seq = c->seq;
2149 out_hdr->sadb_msg_pid = c->pid; 2148 out_hdr->sadb_msg_pid = c->pid;
2150 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp)); 2149 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp));
2151out:
2152 return 0; 2150 return 0;
2153 2151
2154} 2152}
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index ce84237ebad3..ccff6133e19a 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -391,7 +391,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
391 if (SN_GT(mpath->sn, orig_sn) || 391 if (SN_GT(mpath->sn, orig_sn) ||
392 (mpath->sn == orig_sn && 392 (mpath->sn == orig_sn &&
393 action == MPATH_PREQ && 393 action == MPATH_PREQ &&
394 new_metric > mpath->metric)) { 394 new_metric >= mpath->metric)) {
395 process = false; 395 process = false;
396 fresh_info = false; 396 fresh_info = false;
397 } 397 }
@@ -611,7 +611,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
611 611
612 mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, 612 mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr,
613 cpu_to_le32(orig_sn), 0, target_addr, 613 cpu_to_le32(orig_sn), 0, target_addr,
614 cpu_to_le32(target_sn), mpath->next_hop->sta.addr, hopcount, 614 cpu_to_le32(target_sn), next_hop, hopcount,
615 ttl, cpu_to_le32(lifetime), cpu_to_le32(metric), 615 ttl, cpu_to_le32(lifetime), cpu_to_le32(metric),
616 0, sdata); 616 0, sdata);
617 rcu_read_unlock(); 617 rcu_read_unlock();
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 08e1f17a4226..db25fa9ef135 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1991,6 +1991,7 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local,
1991void ieee80211_tx_pending(unsigned long data) 1991void ieee80211_tx_pending(unsigned long data)
1992{ 1992{
1993 struct ieee80211_local *local = (struct ieee80211_local *)data; 1993 struct ieee80211_local *local = (struct ieee80211_local *)data;
1994 struct ieee80211_sub_if_data *sdata;
1994 unsigned long flags; 1995 unsigned long flags;
1995 int i; 1996 int i;
1996 bool txok; 1997 bool txok;
@@ -2027,6 +2028,11 @@ void ieee80211_tx_pending(unsigned long data)
2027 if (!txok) 2028 if (!txok)
2028 break; 2029 break;
2029 } 2030 }
2031
2032 if (skb_queue_empty(&local->pending[i]))
2033 list_for_each_entry_rcu(sdata, &local->interfaces, list)
2034 netif_tx_wake_queue(
2035 netdev_get_tx_queue(sdata->dev, i));
2030 } 2036 }
2031 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 2037 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
2032 2038
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index c453226f06b2..53af57047435 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -279,13 +279,13 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
279 /* someone still has this queue stopped */ 279 /* someone still has this queue stopped */
280 return; 280 return;
281 281
282 if (!skb_queue_empty(&local->pending[queue])) 282 if (skb_queue_empty(&local->pending[queue])) {
283 rcu_read_lock();
284 list_for_each_entry_rcu(sdata, &local->interfaces, list)
285 netif_tx_wake_queue(netdev_get_tx_queue(sdata->dev, queue));
286 rcu_read_unlock();
287 } else
283 tasklet_schedule(&local->tx_pending_tasklet); 288 tasklet_schedule(&local->tx_pending_tasklet);
284
285 rcu_read_lock();
286 list_for_each_entry_rcu(sdata, &local->interfaces, list)
287 netif_tx_wake_queue(netdev_get_tx_queue(sdata->dev, queue));
288 rcu_read_unlock();
289} 289}
290 290
291void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 291void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
@@ -1097,9 +1097,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1097 */ 1097 */
1098 res = drv_start(local); 1098 res = drv_start(local);
1099 if (res) { 1099 if (res) {
1100 WARN(local->suspended, "Harware became unavailable " 1100 WARN(local->suspended, "Hardware became unavailable "
1101 "upon resume. This is could be a software issue" 1101 "upon resume. This could be a software issue "
1102 "prior to suspend or a hardware issue\n"); 1102 "prior to suspend or a hardware issue.\n");
1103 return res; 1103 return res;
1104 } 1104 }
1105 1105
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9e9c48963942..215a64835de8 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -493,6 +493,7 @@ static void hashlimit_ipv6_mask(__be32 *i, unsigned int p)
493 case 64 ... 95: 493 case 64 ... 95:
494 i[2] = maskl(i[2], p - 64); 494 i[2] = maskl(i[2], p - 64);
495 i[3] = 0; 495 i[3] = 0;
496 break;
496 case 96 ... 127: 497 case 96 ... 127:
497 i[3] = maskl(i[3], p - 96); 498 i[3] = maskl(i[3], p - 96);
498 break; 499 break;
@@ -879,7 +880,8 @@ static void dl_seq_stop(struct seq_file *s, void *v)
879 struct xt_hashlimit_htable *htable = s->private; 880 struct xt_hashlimit_htable *htable = s->private;
880 unsigned int *bucket = (unsigned int *)v; 881 unsigned int *bucket = (unsigned int *)v;
881 882
882 kfree(bucket); 883 if (!IS_ERR(bucket))
884 kfree(bucket);
883 spin_unlock_bh(&htable->lock); 885 spin_unlock_bh(&htable->lock);
884} 886}
885 887
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 7073dbb8100c..971d172afece 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -267,7 +267,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par)
267 for (i = 0; i < e->nstamps; i++) { 267 for (i = 0; i < e->nstamps; i++) {
268 if (info->seconds && time_after(time, e->stamps[i])) 268 if (info->seconds && time_after(time, e->stamps[i]))
269 continue; 269 continue;
270 if (info->hit_count && ++hits >= info->hit_count) { 270 if (!info->hit_count || ++hits >= info->hit_count) {
271 ret = !ret; 271 ret = !ret;
272 break; 272 break;
273 } 273 }
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index 0bfeaab88ef5..06ab41b6b57a 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -50,9 +50,12 @@ struct netlbl_domhsh_tbl {
50}; 50};
51 51
52/* Domain hash table */ 52/* Domain hash table */
53/* XXX - updates should be so rare that having one spinlock for the entire 53/* updates should be so rare that having one spinlock for the entire hash table
54 * hash table should be okay */ 54 * should be okay */
55static DEFINE_SPINLOCK(netlbl_domhsh_lock); 55static DEFINE_SPINLOCK(netlbl_domhsh_lock);
56#define netlbl_domhsh_rcu_deref(p) \
57 rcu_dereference_check(p, rcu_read_lock_held() || \
58 lockdep_is_held(&netlbl_domhsh_lock))
56static struct netlbl_domhsh_tbl *netlbl_domhsh = NULL; 59static struct netlbl_domhsh_tbl *netlbl_domhsh = NULL;
57static struct netlbl_dom_map *netlbl_domhsh_def = NULL; 60static struct netlbl_dom_map *netlbl_domhsh_def = NULL;
58 61
@@ -106,7 +109,8 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry)
106 * Description: 109 * Description:
107 * This is the hashing function for the domain hash table, it returns the 110 * This is the hashing function for the domain hash table, it returns the
108 * correct bucket number for the domain. The caller is responsibile for 111 * correct bucket number for the domain. The caller is responsibile for
109 * calling the rcu_read_[un]lock() functions. 112 * ensuring that the hash table is protected with either a RCU read lock or the
113 * hash table lock.
110 * 114 *
111 */ 115 */
112static u32 netlbl_domhsh_hash(const char *key) 116static u32 netlbl_domhsh_hash(const char *key)
@@ -120,7 +124,7 @@ static u32 netlbl_domhsh_hash(const char *key)
120 124
121 for (iter = 0, val = 0, len = strlen(key); iter < len; iter++) 125 for (iter = 0, val = 0, len = strlen(key); iter < len; iter++)
122 val = (val << 4 | (val >> (8 * sizeof(u32) - 4))) ^ key[iter]; 126 val = (val << 4 | (val >> (8 * sizeof(u32) - 4))) ^ key[iter];
123 return val & (rcu_dereference(netlbl_domhsh)->size - 1); 127 return val & (netlbl_domhsh_rcu_deref(netlbl_domhsh)->size - 1);
124} 128}
125 129
126/** 130/**
@@ -130,7 +134,8 @@ static u32 netlbl_domhsh_hash(const char *key)
130 * Description: 134 * Description:
131 * Searches the domain hash table and returns a pointer to the hash table 135 * Searches the domain hash table and returns a pointer to the hash table
132 * entry if found, otherwise NULL is returned. The caller is responsibile for 136 * entry if found, otherwise NULL is returned. The caller is responsibile for
133 * the rcu hash table locks (i.e. the caller much call rcu_read_[un]lock()). 137 * ensuring that the hash table is protected with either a RCU read lock or the
138 * hash table lock.
134 * 139 *
135 */ 140 */
136static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain) 141static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain)
@@ -141,7 +146,7 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain)
141 146
142 if (domain != NULL) { 147 if (domain != NULL) {
143 bkt = netlbl_domhsh_hash(domain); 148 bkt = netlbl_domhsh_hash(domain);
144 bkt_list = &rcu_dereference(netlbl_domhsh)->tbl[bkt]; 149 bkt_list = &netlbl_domhsh_rcu_deref(netlbl_domhsh)->tbl[bkt];
145 list_for_each_entry_rcu(iter, bkt_list, list) 150 list_for_each_entry_rcu(iter, bkt_list, list)
146 if (iter->valid && strcmp(iter->domain, domain) == 0) 151 if (iter->valid && strcmp(iter->domain, domain) == 0)
147 return iter; 152 return iter;
@@ -159,8 +164,8 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain)
159 * Searches the domain hash table and returns a pointer to the hash table 164 * Searches the domain hash table and returns a pointer to the hash table
160 * entry if an exact match is found, if an exact match is not present in the 165 * entry if an exact match is found, if an exact match is not present in the
161 * hash table then the default entry is returned if valid otherwise NULL is 166 * hash table then the default entry is returned if valid otherwise NULL is
162 * returned. The caller is responsibile for the rcu hash table locks 167 * returned. The caller is responsibile ensuring that the hash table is
163 * (i.e. the caller much call rcu_read_[un]lock()). 168 * protected with either a RCU read lock or the hash table lock.
164 * 169 *
165 */ 170 */
166static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain) 171static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain)
@@ -169,7 +174,7 @@ static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain)
169 174
170 entry = netlbl_domhsh_search(domain); 175 entry = netlbl_domhsh_search(domain);
171 if (entry == NULL) { 176 if (entry == NULL) {
172 entry = rcu_dereference(netlbl_domhsh_def); 177 entry = netlbl_domhsh_rcu_deref(netlbl_domhsh_def);
173 if (entry != NULL && !entry->valid) 178 if (entry != NULL && !entry->valid)
174 entry = NULL; 179 entry = NULL;
175 } 180 }
@@ -306,8 +311,11 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
306 struct netlbl_af6list *tmp6; 311 struct netlbl_af6list *tmp6;
307#endif /* IPv6 */ 312#endif /* IPv6 */
308 313
314 /* XXX - we can remove this RCU read lock as the spinlock protects the
315 * entire function, but before we do we need to fixup the
316 * netlbl_af[4,6]list RCU functions to do "the right thing" with
317 * respect to rcu_dereference() when only a spinlock is held. */
309 rcu_read_lock(); 318 rcu_read_lock();
310
311 spin_lock(&netlbl_domhsh_lock); 319 spin_lock(&netlbl_domhsh_lock);
312 if (entry->domain != NULL) 320 if (entry->domain != NULL)
313 entry_old = netlbl_domhsh_search(entry->domain); 321 entry_old = netlbl_domhsh_search(entry->domain);
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 852d9d7976b9..3b4fde7622a3 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -114,6 +114,9 @@ struct netlbl_unlhsh_walk_arg {
114/* updates should be so rare that having one spinlock for the entire 114/* updates should be so rare that having one spinlock for the entire
115 * hash table should be okay */ 115 * hash table should be okay */
116static DEFINE_SPINLOCK(netlbl_unlhsh_lock); 116static DEFINE_SPINLOCK(netlbl_unlhsh_lock);
117#define netlbl_unlhsh_rcu_deref(p) \
118 rcu_dereference_check(p, rcu_read_lock_held() || \
119 lockdep_is_held(&netlbl_unlhsh_lock))
117static struct netlbl_unlhsh_tbl *netlbl_unlhsh = NULL; 120static struct netlbl_unlhsh_tbl *netlbl_unlhsh = NULL;
118static struct netlbl_unlhsh_iface *netlbl_unlhsh_def = NULL; 121static struct netlbl_unlhsh_iface *netlbl_unlhsh_def = NULL;
119 122
@@ -235,15 +238,13 @@ static void netlbl_unlhsh_free_iface(struct rcu_head *entry)
235 * Description: 238 * Description:
236 * This is the hashing function for the unlabeled hash table, it returns the 239 * This is the hashing function for the unlabeled hash table, it returns the
237 * bucket number for the given device/interface. The caller is responsible for 240 * bucket number for the given device/interface. The caller is responsible for
238 * calling the rcu_read_[un]lock() functions. 241 * ensuring that the hash table is protected with either a RCU read lock or
242 * the hash table lock.
239 * 243 *
240 */ 244 */
241static u32 netlbl_unlhsh_hash(int ifindex) 245static u32 netlbl_unlhsh_hash(int ifindex)
242{ 246{
243 /* this is taken _almost_ directly from 247 return ifindex & (netlbl_unlhsh_rcu_deref(netlbl_unlhsh)->size - 1);
244 * security/selinux/netif.c:sel_netif_hasfn() as they do pretty much
245 * the same thing */
246 return ifindex & (rcu_dereference(netlbl_unlhsh)->size - 1);
247} 248}
248 249
249/** 250/**
@@ -253,7 +254,8 @@ static u32 netlbl_unlhsh_hash(int ifindex)
253 * Description: 254 * Description:
254 * Searches the unlabeled connection hash table and returns a pointer to the 255 * Searches the unlabeled connection hash table and returns a pointer to the
255 * interface entry which matches @ifindex, otherwise NULL is returned. The 256 * interface entry which matches @ifindex, otherwise NULL is returned. The
256 * caller is responsible for calling the rcu_read_[un]lock() functions. 257 * caller is responsible for ensuring that the hash table is protected with
258 * either a RCU read lock or the hash table lock.
257 * 259 *
258 */ 260 */
259static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex) 261static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex)
@@ -263,7 +265,7 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex)
263 struct netlbl_unlhsh_iface *iter; 265 struct netlbl_unlhsh_iface *iter;
264 266
265 bkt = netlbl_unlhsh_hash(ifindex); 267 bkt = netlbl_unlhsh_hash(ifindex);
266 bkt_list = &rcu_dereference(netlbl_unlhsh)->tbl[bkt]; 268 bkt_list = &netlbl_unlhsh_rcu_deref(netlbl_unlhsh)->tbl[bkt];
267 list_for_each_entry_rcu(iter, bkt_list, list) 269 list_for_each_entry_rcu(iter, bkt_list, list)
268 if (iter->valid && iter->ifindex == ifindex) 270 if (iter->valid && iter->ifindex == ifindex)
269 return iter; 271 return iter;
@@ -272,33 +274,6 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface(int ifindex)
272} 274}
273 275
274/** 276/**
275 * netlbl_unlhsh_search_iface_def - Search for a matching interface entry
276 * @ifindex: the network interface
277 *
278 * Description:
279 * Searches the unlabeled connection hash table and returns a pointer to the
280 * interface entry which matches @ifindex. If an exact match can not be found
281 * and there is a valid default entry, the default entry is returned, otherwise
282 * NULL is returned. The caller is responsible for calling the
283 * rcu_read_[un]lock() functions.
284 *
285 */
286static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface_def(int ifindex)
287{
288 struct netlbl_unlhsh_iface *entry;
289
290 entry = netlbl_unlhsh_search_iface(ifindex);
291 if (entry != NULL)
292 return entry;
293
294 entry = rcu_dereference(netlbl_unlhsh_def);
295 if (entry != NULL && entry->valid)
296 return entry;
297
298 return NULL;
299}
300
301/**
302 * netlbl_unlhsh_add_addr4 - Add a new IPv4 address entry to the hash table 277 * netlbl_unlhsh_add_addr4 - Add a new IPv4 address entry to the hash table
303 * @iface: the associated interface entry 278 * @iface: the associated interface entry
304 * @addr: IPv4 address in network byte order 279 * @addr: IPv4 address in network byte order
@@ -308,8 +283,7 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_search_iface_def(int ifindex)
308 * Description: 283 * Description:
309 * Add a new address entry into the unlabeled connection hash table using the 284 * Add a new address entry into the unlabeled connection hash table using the
310 * interface entry specified by @iface. On success zero is returned, otherwise 285 * interface entry specified by @iface. On success zero is returned, otherwise
311 * a negative value is returned. The caller is responsible for calling the 286 * a negative value is returned.
312 * rcu_read_[un]lock() functions.
313 * 287 *
314 */ 288 */
315static int netlbl_unlhsh_add_addr4(struct netlbl_unlhsh_iface *iface, 289static int netlbl_unlhsh_add_addr4(struct netlbl_unlhsh_iface *iface,
@@ -349,8 +323,7 @@ static int netlbl_unlhsh_add_addr4(struct netlbl_unlhsh_iface *iface,
349 * Description: 323 * Description:
350 * Add a new address entry into the unlabeled connection hash table using the 324 * Add a new address entry into the unlabeled connection hash table using the
351 * interface entry specified by @iface. On success zero is returned, otherwise 325 * interface entry specified by @iface. On success zero is returned, otherwise
352 * a negative value is returned. The caller is responsible for calling the 326 * a negative value is returned.
353 * rcu_read_[un]lock() functions.
354 * 327 *
355 */ 328 */
356static int netlbl_unlhsh_add_addr6(struct netlbl_unlhsh_iface *iface, 329static int netlbl_unlhsh_add_addr6(struct netlbl_unlhsh_iface *iface,
@@ -391,8 +364,7 @@ static int netlbl_unlhsh_add_addr6(struct netlbl_unlhsh_iface *iface,
391 * Description: 364 * Description:
392 * Add a new, empty, interface entry into the unlabeled connection hash table. 365 * Add a new, empty, interface entry into the unlabeled connection hash table.
393 * On success a pointer to the new interface entry is returned, on failure NULL 366 * On success a pointer to the new interface entry is returned, on failure NULL
394 * is returned. The caller is responsible for calling the rcu_read_[un]lock() 367 * is returned.
395 * functions.
396 * 368 *
397 */ 369 */
398static struct netlbl_unlhsh_iface *netlbl_unlhsh_add_iface(int ifindex) 370static struct netlbl_unlhsh_iface *netlbl_unlhsh_add_iface(int ifindex)
@@ -415,10 +387,10 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_add_iface(int ifindex)
415 if (netlbl_unlhsh_search_iface(ifindex) != NULL) 387 if (netlbl_unlhsh_search_iface(ifindex) != NULL)
416 goto add_iface_failure; 388 goto add_iface_failure;
417 list_add_tail_rcu(&iface->list, 389 list_add_tail_rcu(&iface->list,
418 &rcu_dereference(netlbl_unlhsh)->tbl[bkt]); 390 &netlbl_unlhsh_rcu_deref(netlbl_unlhsh)->tbl[bkt]);
419 } else { 391 } else {
420 INIT_LIST_HEAD(&iface->list); 392 INIT_LIST_HEAD(&iface->list);
421 if (rcu_dereference(netlbl_unlhsh_def) != NULL) 393 if (netlbl_unlhsh_rcu_deref(netlbl_unlhsh_def) != NULL)
422 goto add_iface_failure; 394 goto add_iface_failure;
423 rcu_assign_pointer(netlbl_unlhsh_def, iface); 395 rcu_assign_pointer(netlbl_unlhsh_def, iface);
424 } 396 }
@@ -548,8 +520,7 @@ unlhsh_add_return:
548 * 520 *
549 * Description: 521 * Description:
550 * Remove an IP address entry from the unlabeled connection hash table. 522 * Remove an IP address entry from the unlabeled connection hash table.
551 * Returns zero on success, negative values on failure. The caller is 523 * Returns zero on success, negative values on failure.
552 * responsible for calling the rcu_read_[un]lock() functions.
553 * 524 *
554 */ 525 */
555static int netlbl_unlhsh_remove_addr4(struct net *net, 526static int netlbl_unlhsh_remove_addr4(struct net *net,
@@ -611,8 +582,7 @@ static int netlbl_unlhsh_remove_addr4(struct net *net,
611 * 582 *
612 * Description: 583 * Description:
613 * Remove an IP address entry from the unlabeled connection hash table. 584 * Remove an IP address entry from the unlabeled connection hash table.
614 * Returns zero on success, negative values on failure. The caller is 585 * Returns zero on success, negative values on failure.
615 * responsible for calling the rcu_read_[un]lock() functions.
616 * 586 *
617 */ 587 */
618static int netlbl_unlhsh_remove_addr6(struct net *net, 588static int netlbl_unlhsh_remove_addr6(struct net *net,
@@ -1547,8 +1517,10 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
1547 struct netlbl_unlhsh_iface *iface; 1517 struct netlbl_unlhsh_iface *iface;
1548 1518
1549 rcu_read_lock(); 1519 rcu_read_lock();
1550 iface = netlbl_unlhsh_search_iface_def(skb->skb_iif); 1520 iface = netlbl_unlhsh_search_iface(skb->skb_iif);
1551 if (iface == NULL) 1521 if (iface == NULL)
1522 iface = rcu_dereference(netlbl_unlhsh_def);
1523 if (iface == NULL || !iface->valid)
1552 goto unlabel_getattr_nolabel; 1524 goto unlabel_getattr_nolabel;
1553 switch (family) { 1525 switch (family) {
1554 case PF_INET: { 1526 case PF_INET: {
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 274d977166b7..6464a1972a69 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -683,6 +683,9 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
683 struct netlink_sock *nlk = nlk_sk(sk); 683 struct netlink_sock *nlk = nlk_sk(sk);
684 struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; 684 struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
685 685
686 if (alen < sizeof(addr->sa_family))
687 return -EINVAL;
688
686 if (addr->sa_family == AF_UNSPEC) { 689 if (addr->sa_family == AF_UNSPEC) {
687 sk->sk_state = NETLINK_UNCONNECTED; 690 sk->sk_state = NETLINK_UNCONNECTED;
688 nlk->dst_pid = 0; 691 nlk->dst_pid = 0;
diff --git a/net/rxrpc/ar-accept.c b/net/rxrpc/ar-accept.c
index 77228f28fa36..2d744f22a9a1 100644
--- a/net/rxrpc/ar-accept.c
+++ b/net/rxrpc/ar-accept.c
@@ -88,6 +88,11 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
88 88
89 /* get a notification message to send to the server app */ 89 /* get a notification message to send to the server app */
90 notification = alloc_skb(0, GFP_NOFS); 90 notification = alloc_skb(0, GFP_NOFS);
91 if (!notification) {
92 _debug("no memory");
93 ret = -ENOMEM;
94 goto error_nofree;
95 }
91 rxrpc_new_skb(notification); 96 rxrpc_new_skb(notification);
92 notification->mark = RXRPC_SKB_MARK_NEW_CALL; 97 notification->mark = RXRPC_SKB_MARK_NEW_CALL;
93 98
@@ -189,6 +194,7 @@ invalid_service:
189 ret = -ECONNREFUSED; 194 ret = -ECONNREFUSED;
190error: 195error:
191 rxrpc_free_skb(notification); 196 rxrpc_free_skb(notification);
197error_nofree:
192 _leave(" = %d", ret); 198 _leave(" = %d", ret);
193 return ret; 199 return ret;
194} 200}
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 21f9c7678aa3..2f691fb180d1 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -328,13 +328,16 @@ config NET_CLS_FLOW
328 module will be called cls_flow. 328 module will be called cls_flow.
329 329
330config NET_CLS_CGROUP 330config NET_CLS_CGROUP
331 bool "Control Group Classifier" 331 tristate "Control Group Classifier"
332 select NET_CLS 332 select NET_CLS
333 depends on CGROUPS 333 depends on CGROUPS
334 ---help--- 334 ---help---
335 Say Y here if you want to classify packets based on the control 335 Say Y here if you want to classify packets based on the control
336 cgroup of their process. 336 cgroup of their process.
337 337
338 To compile this code as a module, choose M here: the
339 module will be called cls_cgroup.
340
338config NET_EMATCH 341config NET_EMATCH
339 bool "Extended Matches" 342 bool "Extended Matches"
340 select NET_CLS 343 select NET_CLS
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index e4877ca6727c..7f27d2c15e08 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -24,6 +24,25 @@ struct cgroup_cls_state
24 u32 classid; 24 u32 classid;
25}; 25};
26 26
27static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss,
28 struct cgroup *cgrp);
29static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp);
30static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp);
31
32struct cgroup_subsys net_cls_subsys = {
33 .name = "net_cls",
34 .create = cgrp_create,
35 .destroy = cgrp_destroy,
36 .populate = cgrp_populate,
37#ifdef CONFIG_NET_CLS_CGROUP
38 .subsys_id = net_cls_subsys_id,
39#else
40#define net_cls_subsys_id net_cls_subsys.subsys_id
41#endif
42 .module = THIS_MODULE,
43};
44
45
27static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) 46static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp)
28{ 47{
29 return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id), 48 return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id),
@@ -79,14 +98,6 @@ static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp)
79 return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files)); 98 return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files));
80} 99}
81 100
82struct cgroup_subsys net_cls_subsys = {
83 .name = "net_cls",
84 .create = cgrp_create,
85 .destroy = cgrp_destroy,
86 .populate = cgrp_populate,
87 .subsys_id = net_cls_subsys_id,
88};
89
90struct cls_cgroup_head 101struct cls_cgroup_head
91{ 102{
92 u32 handle; 103 u32 handle;
@@ -277,12 +288,19 @@ static struct tcf_proto_ops cls_cgroup_ops __read_mostly = {
277 288
278static int __init init_cgroup_cls(void) 289static int __init init_cgroup_cls(void)
279{ 290{
280 return register_tcf_proto_ops(&cls_cgroup_ops); 291 int ret = register_tcf_proto_ops(&cls_cgroup_ops);
292 if (ret)
293 return ret;
294 ret = cgroup_load_subsys(&net_cls_subsys);
295 if (ret)
296 unregister_tcf_proto_ops(&cls_cgroup_ops);
297 return ret;
281} 298}
282 299
283static void __exit exit_cgroup_cls(void) 300static void __exit exit_cgroup_cls(void)
284{ 301{
285 unregister_tcf_proto_ops(&cls_cgroup_ops); 302 unregister_tcf_proto_ops(&cls_cgroup_ops);
303 cgroup_unload_subsys(&net_cls_subsys);
286} 304}
287 305
288module_init(init_cgroup_cls); 306module_init(init_cgroup_cls);
diff --git a/net/socket.c b/net/socket.c
index ae904b58d9f5..ad2e8153c618 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2134,6 +2134,10 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
2134 break; 2134 break;
2135 ++datagrams; 2135 ++datagrams;
2136 2136
2137 /* MSG_WAITFORONE turns on MSG_DONTWAIT after one packet */
2138 if (flags & MSG_WAITFORONE)
2139 flags |= MSG_DONTWAIT;
2140
2137 if (timeout) { 2141 if (timeout) {
2138 ktime_get_ts(timeout); 2142 ktime_get_ts(timeout);
2139 *timeout = timespec_sub(end_time, *timeout); 2143 *timeout = timespec_sub(end_time, *timeout);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 75ab08eac66b..e4839c07c913 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -548,8 +548,6 @@ static int xs_udp_send_request(struct rpc_task *task)
548 /* Still some bytes left; set up for a retry later. */ 548 /* Still some bytes left; set up for a retry later. */
549 status = -EAGAIN; 549 status = -EAGAIN;
550 } 550 }
551 if (!transport->sock)
552 goto out;
553 551
554 switch (status) { 552 switch (status) {
555 case -ENOTSOCK: 553 case -ENOTSOCK:
@@ -569,7 +567,7 @@ static int xs_udp_send_request(struct rpc_task *task)
569 * prompts ECONNREFUSED. */ 567 * prompts ECONNREFUSED. */
570 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); 568 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
571 } 569 }
572out: 570
573 return status; 571 return status;
574} 572}
575 573
@@ -651,8 +649,6 @@ static int xs_tcp_send_request(struct rpc_task *task)
651 status = -EAGAIN; 649 status = -EAGAIN;
652 break; 650 break;
653 } 651 }
654 if (!transport->sock)
655 goto out;
656 652
657 switch (status) { 653 switch (status) {
658 case -ENOTSOCK: 654 case -ENOTSOCK:
@@ -672,7 +668,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
672 case -ENOTCONN: 668 case -ENOTCONN:
673 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags); 669 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
674 } 670 }
675out: 671
676 return status; 672 return status;
677} 673}
678 674
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ed89c59bb431..81fcafc60150 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -324,7 +324,7 @@ struct reg_regdb_search_request {
324}; 324};
325 325
326static LIST_HEAD(reg_regdb_search_list); 326static LIST_HEAD(reg_regdb_search_list);
327static DEFINE_SPINLOCK(reg_regdb_search_lock); 327static DEFINE_MUTEX(reg_regdb_search_mutex);
328 328
329static void reg_regdb_search(struct work_struct *work) 329static void reg_regdb_search(struct work_struct *work)
330{ 330{
@@ -332,7 +332,7 @@ static void reg_regdb_search(struct work_struct *work)
332 const struct ieee80211_regdomain *curdom, *regdom; 332 const struct ieee80211_regdomain *curdom, *regdom;
333 int i, r; 333 int i, r;
334 334
335 spin_lock(&reg_regdb_search_lock); 335 mutex_lock(&reg_regdb_search_mutex);
336 while (!list_empty(&reg_regdb_search_list)) { 336 while (!list_empty(&reg_regdb_search_list)) {
337 request = list_first_entry(&reg_regdb_search_list, 337 request = list_first_entry(&reg_regdb_search_list,
338 struct reg_regdb_search_request, 338 struct reg_regdb_search_request,
@@ -346,18 +346,16 @@ static void reg_regdb_search(struct work_struct *work)
346 r = reg_copy_regd(&regdom, curdom); 346 r = reg_copy_regd(&regdom, curdom);
347 if (r) 347 if (r)
348 break; 348 break;
349 spin_unlock(&reg_regdb_search_lock);
350 mutex_lock(&cfg80211_mutex); 349 mutex_lock(&cfg80211_mutex);
351 set_regdom(regdom); 350 set_regdom(regdom);
352 mutex_unlock(&cfg80211_mutex); 351 mutex_unlock(&cfg80211_mutex);
353 spin_lock(&reg_regdb_search_lock);
354 break; 352 break;
355 } 353 }
356 } 354 }
357 355
358 kfree(request); 356 kfree(request);
359 } 357 }
360 spin_unlock(&reg_regdb_search_lock); 358 mutex_unlock(&reg_regdb_search_mutex);
361} 359}
362 360
363static DECLARE_WORK(reg_regdb_work, reg_regdb_search); 361static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
@@ -375,9 +373,9 @@ static void reg_regdb_query(const char *alpha2)
375 373
376 memcpy(request->alpha2, alpha2, 2); 374 memcpy(request->alpha2, alpha2, 2);
377 375
378 spin_lock(&reg_regdb_search_lock); 376 mutex_lock(&reg_regdb_search_mutex);
379 list_add_tail(&request->list, &reg_regdb_search_list); 377 list_add_tail(&request->list, &reg_regdb_search_list);
380 spin_unlock(&reg_regdb_search_lock); 378 mutex_unlock(&reg_regdb_search_mutex);
381 379
382 schedule_work(&reg_regdb_work); 380 schedule_work(&reg_regdb_work);
383} 381}