aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-12 23:30:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-12 23:30:02 -0500
commit7c17d86a8502c2e30c2eea777ed1b830aa3b447b (patch)
tree353f739a33f46f9861b479e64d2a59f9b5c85868 /net
parent2485a4b610171f4e1c4ab0d053569747795c1bbe (diff)
parent91dce7ddab99a29b600e3d792b847dc2cdbf0848 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (69 commits) pptp: Accept packet with seq zero RDS: Remove some unused iWARP code net: fsl: fec: handle 10Mbps speed in RMII mode drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c: add missing iounmap drivers/net/ethernet/tundra/tsi108_eth.c: add missing iounmap ksz884x: fix mtu for VLAN net_sched: sfq: add optional RED on top of SFQ dp83640: Fix NOHZ local_softirq_pending 08 warning gianfar: Fix invalid TX frames returned on error queue when time stamping gianfar: Fix missing sock reference when processing TX time stamps phylib: introduce mdiobus_alloc_size() net: decrement memcg jump label when limit, not usage, is changed net: reintroduce missing rcu_assign_pointer() calls inet_diag: Rename inet_diag_req_compat into inet_diag_req inet_diag: Rename inet_diag_req into inet_diag_req_v2 bond_alb: don't disable softirq under bond_alb_xmit mac80211: fix rx->key NULL pointer dereference in promiscuous mode nl80211: fix old station flags compatibility mdio-octeon: use an unique MDIO bus name. mdio-gpio: use an unique MDIO bus name. ...
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/af_bluetooth.c8
-rw-r--r--net/bluetooth/hci_event.c22
-rw-r--r--net/bluetooth/hci_sock.c2
-rw-r--r--net/bluetooth/l2cap_core.c26
-rw-r--r--net/bluetooth/l2cap_sock.c2
-rw-r--r--net/bluetooth/mgmt.c4
-rw-r--r--net/bluetooth/rfcomm/sock.c12
-rw-r--r--net/bluetooth/rfcomm/tty.c22
-rw-r--r--net/bluetooth/sco.c8
-rw-r--r--net/core/net-sysfs.c6
-rw-r--r--net/core/netpoll.c2
-rw-r--r--net/dccp/diag.c4
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_trie.c10
-rw-r--r--net/ipv4/igmp.c8
-rw-r--r--net/ipv4/inet_diag.c42
-rw-r--r--net/ipv4/ipip.c8
-rw-r--r--net/ipv4/ipmr.c2
-rw-r--r--net/ipv4/tcp_diag.c4
-rw-r--r--net/ipv4/tcp_memcontrol.c2
-rw-r--r--net/ipv4/udp_diag.c14
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/ip6_tunnel.c8
-rw-r--r--net/ipv6/raw.c2
-rw-r--r--net/ipv6/sit.c10
-rw-r--r--net/mac80211/agg-rx.c2
-rw-r--r--net/mac80211/cfg.c4
-rw-r--r--net/mac80211/ibss.c2
-rw-r--r--net/mac80211/sta_info.c6
-rw-r--r--net/mac80211/wpa.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c2
-rw-r--r--net/netfilter/nf_conntrack_ecache.c4
-rw-r--r--net/netfilter/nf_conntrack_extend.c2
-rw-r--r--net/netfilter/nf_conntrack_helper.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c2
-rw-r--r--net/netfilter/nf_log.c6
-rw-r--r--net/netfilter/nf_queue.c2
-rw-r--r--net/netfilter/nfnetlink.c4
-rw-r--r--net/netlabel/netlabel_domainhash.c4
-rw-r--r--net/netlabel/netlabel_unlabeled.c6
-rw-r--r--net/phonet/af_phonet.c2
-rw-r--r--net/phonet/pn_dev.c2
-rw-r--r--net/phonet/socket.c2
-rw-r--r--net/rds/iw_rdma.c15
-rw-r--r--net/sched/sch_sfq.c146
-rw-r--r--net/socket.c2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c2
-rw-r--r--net/wireless/nl80211.c34
-rw-r--r--net/xfrm/xfrm_user.c2
50 files changed, 311 insertions, 182 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index cdcfcabb34ab..ef92864ac625 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -156,17 +156,17 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto,
156 156
157void bt_sock_link(struct bt_sock_list *l, struct sock *sk) 157void bt_sock_link(struct bt_sock_list *l, struct sock *sk)
158{ 158{
159 write_lock_bh(&l->lock); 159 write_lock(&l->lock);
160 sk_add_node(sk, &l->head); 160 sk_add_node(sk, &l->head);
161 write_unlock_bh(&l->lock); 161 write_unlock(&l->lock);
162} 162}
163EXPORT_SYMBOL(bt_sock_link); 163EXPORT_SYMBOL(bt_sock_link);
164 164
165void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk) 165void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
166{ 166{
167 write_lock_bh(&l->lock); 167 write_lock(&l->lock);
168 sk_del_node_init(sk); 168 sk_del_node_init(sk);
169 write_unlock_bh(&l->lock); 169 write_unlock(&l->lock);
170} 170}
171EXPORT_SYMBOL(bt_sock_unlink); 171EXPORT_SYMBOL(bt_sock_unlink);
172 172
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4221bd256bdd..001307f81057 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -711,7 +711,14 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
711 if (rp->status) 711 if (rp->status)
712 return; 712 return;
713 713
714 memcpy(hdev->extfeatures, rp->features, 8); 714 switch (rp->page) {
715 case 0:
716 memcpy(hdev->features, rp->features, 8);
717 break;
718 case 1:
719 memcpy(hdev->host_features, rp->features, 8);
720 break;
721 }
715 722
716 hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status); 723 hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status);
717} 724}
@@ -1047,9 +1054,7 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
1047 case LE_SCANNING_DISABLED: 1054 case LE_SCANNING_DISABLED:
1048 clear_bit(HCI_LE_SCAN, &hdev->dev_flags); 1055 clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
1049 1056
1050 cancel_delayed_work_sync(&hdev->adv_work); 1057 schedule_delayed_work(&hdev->adv_work, ADV_CLEAR_TIMEOUT);
1051 queue_delayed_work(hdev->workqueue, &hdev->adv_work,
1052 jiffies + ADV_CLEAR_TIMEOUT);
1053 break; 1058 break;
1054 1059
1055 default: 1060 default:
@@ -2266,20 +2271,19 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
2266 struct hci_ev_num_comp_pkts *ev = (void *) skb->data; 2271 struct hci_ev_num_comp_pkts *ev = (void *) skb->data;
2267 int i; 2272 int i;
2268 2273
2269 skb_pull(skb, sizeof(*ev));
2270
2271 BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl);
2272
2273 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) { 2274 if (hdev->flow_ctl_mode != HCI_FLOW_CTL_MODE_PACKET_BASED) {
2274 BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode); 2275 BT_ERR("Wrong event for mode %d", hdev->flow_ctl_mode);
2275 return; 2276 return;
2276 } 2277 }
2277 2278
2278 if (skb->len < ev->num_hndl * 4) { 2279 if (skb->len < sizeof(*ev) || skb->len < sizeof(*ev) +
2280 ev->num_hndl * sizeof(struct hci_comp_pkts_info)) {
2279 BT_DBG("%s bad parameters", hdev->name); 2281 BT_DBG("%s bad parameters", hdev->name);
2280 return; 2282 return;
2281 } 2283 }
2282 2284
2285 BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl);
2286
2283 for (i = 0; i < ev->num_hndl; i++) { 2287 for (i = 0; i < ev->num_hndl; i++) {
2284 struct hci_comp_pkts_info *info = &ev->handles[i]; 2288 struct hci_comp_pkts_info *info = &ev->handles[i];
2285 struct hci_conn *conn; 2289 struct hci_conn *conn;
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 6d94616af312..0dcc96266779 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -767,7 +767,6 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
767 /* Detach sockets from device */ 767 /* Detach sockets from device */
768 read_lock(&hci_sk_list.lock); 768 read_lock(&hci_sk_list.lock);
769 sk_for_each(sk, node, &hci_sk_list.head) { 769 sk_for_each(sk, node, &hci_sk_list.head) {
770 local_bh_disable();
771 bh_lock_sock_nested(sk); 770 bh_lock_sock_nested(sk);
772 if (hci_pi(sk)->hdev == hdev) { 771 if (hci_pi(sk)->hdev == hdev) {
773 hci_pi(sk)->hdev = NULL; 772 hci_pi(sk)->hdev = NULL;
@@ -778,7 +777,6 @@ static int hci_sock_dev_event(struct notifier_block *this, unsigned long event,
778 hci_dev_put(hdev); 777 hci_dev_put(hdev);
779 } 778 }
780 bh_unlock_sock(sk); 779 bh_unlock_sock(sk);
781 local_bh_enable();
782 } 780 }
783 read_unlock(&hci_sk_list.lock); 781 read_unlock(&hci_sk_list.lock);
784 } 782 }
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index aa78d8c4b93b..faf0b11ac1d3 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -165,7 +165,7 @@ int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm)
165{ 165{
166 int err; 166 int err;
167 167
168 write_lock_bh(&chan_list_lock); 168 write_lock(&chan_list_lock);
169 169
170 if (psm && __l2cap_global_chan_by_addr(psm, src)) { 170 if (psm && __l2cap_global_chan_by_addr(psm, src)) {
171 err = -EADDRINUSE; 171 err = -EADDRINUSE;
@@ -190,17 +190,17 @@ int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm)
190 } 190 }
191 191
192done: 192done:
193 write_unlock_bh(&chan_list_lock); 193 write_unlock(&chan_list_lock);
194 return err; 194 return err;
195} 195}
196 196
197int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid) 197int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid)
198{ 198{
199 write_lock_bh(&chan_list_lock); 199 write_lock(&chan_list_lock);
200 200
201 chan->scid = scid; 201 chan->scid = scid;
202 202
203 write_unlock_bh(&chan_list_lock); 203 write_unlock(&chan_list_lock);
204 204
205 return 0; 205 return 0;
206} 206}
@@ -289,9 +289,9 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk)
289 289
290 chan->sk = sk; 290 chan->sk = sk;
291 291
292 write_lock_bh(&chan_list_lock); 292 write_lock(&chan_list_lock);
293 list_add(&chan->global_l, &chan_list); 293 list_add(&chan->global_l, &chan_list);
294 write_unlock_bh(&chan_list_lock); 294 write_unlock(&chan_list_lock);
295 295
296 INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout); 296 INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout);
297 297
@@ -306,9 +306,9 @@ struct l2cap_chan *l2cap_chan_create(struct sock *sk)
306 306
307void l2cap_chan_destroy(struct l2cap_chan *chan) 307void l2cap_chan_destroy(struct l2cap_chan *chan)
308{ 308{
309 write_lock_bh(&chan_list_lock); 309 write_lock(&chan_list_lock);
310 list_del(&chan->global_l); 310 list_del(&chan->global_l);
311 write_unlock_bh(&chan_list_lock); 311 write_unlock(&chan_list_lock);
312 312
313 l2cap_chan_put(chan); 313 l2cap_chan_put(chan);
314} 314}
@@ -543,14 +543,14 @@ static u8 l2cap_get_ident(struct l2cap_conn *conn)
543 * 200 - 254 are used by utilities like l2ping, etc. 543 * 200 - 254 are used by utilities like l2ping, etc.
544 */ 544 */
545 545
546 spin_lock_bh(&conn->lock); 546 spin_lock(&conn->lock);
547 547
548 if (++conn->tx_ident > 128) 548 if (++conn->tx_ident > 128)
549 conn->tx_ident = 1; 549 conn->tx_ident = 1;
550 550
551 id = conn->tx_ident; 551 id = conn->tx_ident;
552 552
553 spin_unlock_bh(&conn->lock); 553 spin_unlock(&conn->lock);
554 554
555 return id; 555 return id;
556} 556}
@@ -1190,7 +1190,7 @@ inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdad
1190 } 1190 }
1191 1191
1192 /* Set destination address and psm */ 1192 /* Set destination address and psm */
1193 bacpy(&bt_sk(sk)->dst, src); 1193 bacpy(&bt_sk(sk)->dst, dst);
1194 chan->psm = psm; 1194 chan->psm = psm;
1195 chan->dcid = cid; 1195 chan->dcid = cid;
1196 1196
@@ -4702,7 +4702,7 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
4702{ 4702{
4703 struct l2cap_chan *c; 4703 struct l2cap_chan *c;
4704 4704
4705 read_lock_bh(&chan_list_lock); 4705 read_lock(&chan_list_lock);
4706 4706
4707 list_for_each_entry(c, &chan_list, global_l) { 4707 list_for_each_entry(c, &chan_list, global_l) {
4708 struct sock *sk = c->sk; 4708 struct sock *sk = c->sk;
@@ -4715,7 +4715,7 @@ static int l2cap_debugfs_show(struct seq_file *f, void *p)
4715 c->sec_level, c->mode); 4715 c->sec_level, c->mode);
4716} 4716}
4717 4717
4718 read_unlock_bh(&chan_list_lock); 4718 read_unlock(&chan_list_lock);
4719 4719
4720 return 0; 4720 return 0;
4721} 4721}
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 9ca5616166f7..c61d967012b2 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -587,6 +587,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
587 if (smp_conn_security(conn, sec.level)) 587 if (smp_conn_security(conn, sec.level))
588 break; 588 break;
589 sk->sk_state = BT_CONFIG; 589 sk->sk_state = BT_CONFIG;
590 chan->state = BT_CONFIG;
590 591
591 /* or for ACL link, under defer_setup time */ 592 /* or for ACL link, under defer_setup time */
592 } else if (sk->sk_state == BT_CONNECT2 && 593 } else if (sk->sk_state == BT_CONNECT2 &&
@@ -731,6 +732,7 @@ static int l2cap_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct ms
731 732
732 if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) { 733 if (sk->sk_state == BT_CONNECT2 && bt_sk(sk)->defer_setup) {
733 sk->sk_state = BT_CONFIG; 734 sk->sk_state = BT_CONFIG;
735 pi->chan->state = BT_CONFIG;
734 736
735 __l2cap_connect_rsp_defer(pi->chan); 737 __l2cap_connect_rsp_defer(pi->chan);
736 release_sock(sk); 738 release_sock(sk);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 2540944d871f..bc8e59dda78e 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -291,7 +291,7 @@ static u32 get_current_settings(struct hci_dev *hdev)
291 if (!(hdev->features[4] & LMP_NO_BREDR)) 291 if (!(hdev->features[4] & LMP_NO_BREDR))
292 settings |= MGMT_SETTING_BREDR; 292 settings |= MGMT_SETTING_BREDR;
293 293
294 if (hdev->extfeatures[0] & LMP_HOST_LE) 294 if (hdev->host_features[0] & LMP_HOST_LE)
295 settings |= MGMT_SETTING_LE; 295 settings |= MGMT_SETTING_LE;
296 296
297 if (test_bit(HCI_AUTH, &hdev->flags)) 297 if (test_bit(HCI_AUTH, &hdev->flags))
@@ -2756,7 +2756,7 @@ int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status)
2756 if (!cmd) 2756 if (!cmd)
2757 return -ENOENT; 2757 return -ENOENT;
2758 2758
2759 err = cmd_status(cmd->sk, hdev->id, cmd->opcode, status); 2759 err = cmd_status(cmd->sk, hdev->id, cmd->opcode, mgmt_status(status));
2760 mgmt_pending_remove(cmd); 2760 mgmt_pending_remove(cmd);
2761 2761
2762 return err; 2762 return err;
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index aea2bdd1510f..f066678faeee 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -370,7 +370,7 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr
370 goto done; 370 goto done;
371 } 371 }
372 372
373 write_lock_bh(&rfcomm_sk_list.lock); 373 write_lock(&rfcomm_sk_list.lock);
374 374
375 if (sa->rc_channel && __rfcomm_get_sock_by_addr(sa->rc_channel, &sa->rc_bdaddr)) { 375 if (sa->rc_channel && __rfcomm_get_sock_by_addr(sa->rc_channel, &sa->rc_bdaddr)) {
376 err = -EADDRINUSE; 376 err = -EADDRINUSE;
@@ -381,7 +381,7 @@ static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr
381 sk->sk_state = BT_BOUND; 381 sk->sk_state = BT_BOUND;
382 } 382 }
383 383
384 write_unlock_bh(&rfcomm_sk_list.lock); 384 write_unlock(&rfcomm_sk_list.lock);
385 385
386done: 386done:
387 release_sock(sk); 387 release_sock(sk);
@@ -455,7 +455,7 @@ static int rfcomm_sock_listen(struct socket *sock, int backlog)
455 455
456 err = -EINVAL; 456 err = -EINVAL;
457 457
458 write_lock_bh(&rfcomm_sk_list.lock); 458 write_lock(&rfcomm_sk_list.lock);
459 459
460 for (channel = 1; channel < 31; channel++) 460 for (channel = 1; channel < 31; channel++)
461 if (!__rfcomm_get_sock_by_addr(channel, src)) { 461 if (!__rfcomm_get_sock_by_addr(channel, src)) {
@@ -464,7 +464,7 @@ static int rfcomm_sock_listen(struct socket *sock, int backlog)
464 break; 464 break;
465 } 465 }
466 466
467 write_unlock_bh(&rfcomm_sk_list.lock); 467 write_unlock(&rfcomm_sk_list.lock);
468 468
469 if (err < 0) 469 if (err < 0)
470 goto done; 470 goto done;
@@ -982,7 +982,7 @@ static int rfcomm_sock_debugfs_show(struct seq_file *f, void *p)
982 struct sock *sk; 982 struct sock *sk;
983 struct hlist_node *node; 983 struct hlist_node *node;
984 984
985 read_lock_bh(&rfcomm_sk_list.lock); 985 read_lock(&rfcomm_sk_list.lock);
986 986
987 sk_for_each(sk, node, &rfcomm_sk_list.head) { 987 sk_for_each(sk, node, &rfcomm_sk_list.head) {
988 seq_printf(f, "%s %s %d %d\n", 988 seq_printf(f, "%s %s %d %d\n",
@@ -991,7 +991,7 @@ static int rfcomm_sock_debugfs_show(struct seq_file *f, void *p)
991 sk->sk_state, rfcomm_pi(sk)->channel); 991 sk->sk_state, rfcomm_pi(sk)->channel);
992 } 992 }
993 993
994 read_unlock_bh(&rfcomm_sk_list.lock); 994 read_unlock(&rfcomm_sk_list.lock);
995 995
996 return 0; 996 return 0;
997} 997}
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index fa8f4de53b99..a2d4f5122a6a 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -76,7 +76,7 @@ struct rfcomm_dev {
76}; 76};
77 77
78static LIST_HEAD(rfcomm_dev_list); 78static LIST_HEAD(rfcomm_dev_list);
79static DEFINE_RWLOCK(rfcomm_dev_lock); 79static DEFINE_SPINLOCK(rfcomm_dev_lock);
80 80
81static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb); 81static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb);
82static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err); 82static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err);
@@ -146,7 +146,7 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id)
146{ 146{
147 struct rfcomm_dev *dev; 147 struct rfcomm_dev *dev;
148 148
149 read_lock(&rfcomm_dev_lock); 149 spin_lock(&rfcomm_dev_lock);
150 150
151 dev = __rfcomm_dev_get(id); 151 dev = __rfcomm_dev_get(id);
152 152
@@ -157,7 +157,7 @@ static inline struct rfcomm_dev *rfcomm_dev_get(int id)
157 rfcomm_dev_hold(dev); 157 rfcomm_dev_hold(dev);
158 } 158 }
159 159
160 read_unlock(&rfcomm_dev_lock); 160 spin_unlock(&rfcomm_dev_lock);
161 161
162 return dev; 162 return dev;
163} 163}
@@ -205,7 +205,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
205 if (!dev) 205 if (!dev)
206 return -ENOMEM; 206 return -ENOMEM;
207 207
208 write_lock_bh(&rfcomm_dev_lock); 208 spin_lock(&rfcomm_dev_lock);
209 209
210 if (req->dev_id < 0) { 210 if (req->dev_id < 0) {
211 dev->id = 0; 211 dev->id = 0;
@@ -290,7 +290,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
290 __module_get(THIS_MODULE); 290 __module_get(THIS_MODULE);
291 291
292out: 292out:
293 write_unlock_bh(&rfcomm_dev_lock); 293 spin_unlock(&rfcomm_dev_lock);
294 294
295 if (err < 0) 295 if (err < 0)
296 goto free; 296 goto free;
@@ -327,9 +327,9 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
327 if (atomic_read(&dev->opened) > 0) 327 if (atomic_read(&dev->opened) > 0)
328 return; 328 return;
329 329
330 write_lock_bh(&rfcomm_dev_lock); 330 spin_lock(&rfcomm_dev_lock);
331 list_del_init(&dev->list); 331 list_del_init(&dev->list);
332 write_unlock_bh(&rfcomm_dev_lock); 332 spin_unlock(&rfcomm_dev_lock);
333 333
334 rfcomm_dev_put(dev); 334 rfcomm_dev_put(dev);
335} 335}
@@ -473,7 +473,7 @@ static int rfcomm_get_dev_list(void __user *arg)
473 473
474 di = dl->dev_info; 474 di = dl->dev_info;
475 475
476 read_lock_bh(&rfcomm_dev_lock); 476 spin_lock(&rfcomm_dev_lock);
477 477
478 list_for_each_entry(dev, &rfcomm_dev_list, list) { 478 list_for_each_entry(dev, &rfcomm_dev_list, list) {
479 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) 479 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
@@ -488,7 +488,7 @@ static int rfcomm_get_dev_list(void __user *arg)
488 break; 488 break;
489 } 489 }
490 490
491 read_unlock_bh(&rfcomm_dev_lock); 491 spin_unlock(&rfcomm_dev_lock);
492 492
493 dl->dev_num = n; 493 dl->dev_num = n;
494 size = sizeof(*dl) + n * sizeof(*di); 494 size = sizeof(*dl) + n * sizeof(*di);
@@ -766,9 +766,9 @@ static void rfcomm_tty_close(struct tty_struct *tty, struct file *filp)
766 rfcomm_dlc_unlock(dev->dlc); 766 rfcomm_dlc_unlock(dev->dlc);
767 767
768 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) { 768 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags)) {
769 write_lock_bh(&rfcomm_dev_lock); 769 spin_lock(&rfcomm_dev_lock);
770 list_del_init(&dev->list); 770 list_del_init(&dev->list);
771 write_unlock_bh(&rfcomm_dev_lock); 771 spin_unlock(&rfcomm_dev_lock);
772 772
773 rfcomm_dev_put(dev); 773 rfcomm_dev_put(dev);
774 } 774 }
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 5dc2f2126fac..8bf26d1bc5c1 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -482,7 +482,7 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
482 goto done; 482 goto done;
483 } 483 }
484 484
485 write_lock_bh(&sco_sk_list.lock); 485 write_lock(&sco_sk_list.lock);
486 486
487 if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) { 487 if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) {
488 err = -EADDRINUSE; 488 err = -EADDRINUSE;
@@ -492,7 +492,7 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
492 sk->sk_state = BT_BOUND; 492 sk->sk_state = BT_BOUND;
493 } 493 }
494 494
495 write_unlock_bh(&sco_sk_list.lock); 495 write_unlock(&sco_sk_list.lock);
496 496
497done: 497done:
498 release_sock(sk); 498 release_sock(sk);
@@ -965,14 +965,14 @@ static int sco_debugfs_show(struct seq_file *f, void *p)
965 struct sock *sk; 965 struct sock *sk;
966 struct hlist_node *node; 966 struct hlist_node *node;
967 967
968 read_lock_bh(&sco_sk_list.lock); 968 read_lock(&sco_sk_list.lock);
969 969
970 sk_for_each(sk, node, &sco_sk_list.head) { 970 sk_for_each(sk, node, &sco_sk_list.head) {
971 seq_printf(f, "%s %s %d\n", batostr(&bt_sk(sk)->src), 971 seq_printf(f, "%s %s %d\n", batostr(&bt_sk(sk)->src),
972 batostr(&bt_sk(sk)->dst), sk->sk_state); 972 batostr(&bt_sk(sk)->dst), sk->sk_state);
973 } 973 }
974 974
975 read_unlock_bh(&sco_sk_list.lock); 975 read_unlock(&sco_sk_list.lock);
976 976
977 return 0; 977 return 0;
978} 978}
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index abf4393a77b3..f3dbd4f596a4 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1177,9 +1177,9 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
1177 nonempty = 1; 1177 nonempty = 1;
1178 } 1178 }
1179 1179
1180 if (nonempty) 1180 if (nonempty) {
1181 RCU_INIT_POINTER(dev->xps_maps, new_dev_maps); 1181 rcu_assign_pointer(dev->xps_maps, new_dev_maps);
1182 else { 1182 } else {
1183 kfree(new_dev_maps); 1183 kfree(new_dev_maps);
1184 RCU_INIT_POINTER(dev->xps_maps, NULL); 1184 RCU_INIT_POINTER(dev->xps_maps, NULL);
1185 } 1185 }
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 0d38808a2305..556b08298669 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -765,7 +765,7 @@ int __netpoll_setup(struct netpoll *np)
765 } 765 }
766 766
767 /* last thing to do is link it to the net device structure */ 767 /* last thing to do is link it to the net device structure */
768 RCU_INIT_POINTER(ndev->npinfo, npinfo); 768 rcu_assign_pointer(ndev->npinfo, npinfo);
769 769
770 return 0; 770 return 0;
771 771
diff --git a/net/dccp/diag.c b/net/dccp/diag.c
index 8f1625753377..028fc43aacbd 100644
--- a/net/dccp/diag.c
+++ b/net/dccp/diag.c
@@ -49,13 +49,13 @@ static void dccp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
49} 49}
50 50
51static void dccp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 51static void dccp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
52 struct inet_diag_req *r, struct nlattr *bc) 52 struct inet_diag_req_v2 *r, struct nlattr *bc)
53{ 53{
54 inet_diag_dump_icsk(&dccp_hashinfo, skb, cb, r, bc); 54 inet_diag_dump_icsk(&dccp_hashinfo, skb, cb, r, bc);
55} 55}
56 56
57static int dccp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 57static int dccp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
58 struct inet_diag_req *req) 58 struct inet_diag_req_v2 *req)
59{ 59{
60 return inet_diag_dump_one_icsk(&dccp_hashinfo, in_skb, nlh, req); 60 return inet_diag_dump_one_icsk(&dccp_hashinfo, in_skb, nlh, req);
61} 61}
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 2ab16e12520c..74d321a60e7b 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -388,7 +388,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
388 } 388 }
389 389
390 ifa->ifa_next = dn_db->ifa_list; 390 ifa->ifa_next = dn_db->ifa_list;
391 RCU_INIT_POINTER(dn_db->ifa_list, ifa); 391 rcu_assign_pointer(dn_db->ifa_list, ifa);
392 392
393 dn_ifaddr_notify(RTM_NEWADDR, ifa); 393 dn_ifaddr_notify(RTM_NEWADDR, ifa);
394 blocking_notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa); 394 blocking_notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa);
@@ -1093,7 +1093,7 @@ static struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
1093 1093
1094 memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms)); 1094 memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms));
1095 1095
1096 RCU_INIT_POINTER(dev->dn_ptr, dn_db); 1096 rcu_assign_pointer(dev->dn_ptr, dn_db);
1097 dn_db->dev = dev; 1097 dn_db->dev = dev;
1098 init_timer(&dn_db->timer); 1098 init_timer(&dn_db->timer);
1099 1099
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 65f01dc47565..e41c40f48cfe 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -258,7 +258,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
258 ip_mc_up(in_dev); 258 ip_mc_up(in_dev);
259 259
260 /* we can receive as soon as ip_ptr is set -- do this last */ 260 /* we can receive as soon as ip_ptr is set -- do this last */
261 RCU_INIT_POINTER(dev->ip_ptr, in_dev); 261 rcu_assign_pointer(dev->ip_ptr, in_dev);
262out: 262out:
263 return in_dev; 263 return in_dev;
264out_kfree: 264out_kfree:
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index d04b13ae18fe..2b555a5521e0 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -205,7 +205,7 @@ static inline struct tnode *node_parent_rcu(const struct rt_trie_node *node)
205 return (struct tnode *)(parent & ~NODE_TYPE_MASK); 205 return (struct tnode *)(parent & ~NODE_TYPE_MASK);
206} 206}
207 207
208/* Same as RCU_INIT_POINTER 208/* Same as rcu_assign_pointer
209 * but that macro() assumes that value is a pointer. 209 * but that macro() assumes that value is a pointer.
210 */ 210 */
211static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr) 211static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr)
@@ -529,7 +529,7 @@ static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *
529 if (n) 529 if (n)
530 node_set_parent(n, tn); 530 node_set_parent(n, tn);
531 531
532 RCU_INIT_POINTER(tn->child[i], n); 532 rcu_assign_pointer(tn->child[i], n);
533} 533}
534 534
535#define MAX_WORK 10 535#define MAX_WORK 10
@@ -1015,7 +1015,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
1015 1015
1016 tp = node_parent((struct rt_trie_node *) tn); 1016 tp = node_parent((struct rt_trie_node *) tn);
1017 if (!tp) 1017 if (!tp)
1018 RCU_INIT_POINTER(t->trie, (struct rt_trie_node *)tn); 1018 rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
1019 1019
1020 tnode_free_flush(); 1020 tnode_free_flush();
1021 if (!tp) 1021 if (!tp)
@@ -1027,7 +1027,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
1027 if (IS_TNODE(tn)) 1027 if (IS_TNODE(tn))
1028 tn = (struct tnode *)resize(t, (struct tnode *)tn); 1028 tn = (struct tnode *)resize(t, (struct tnode *)tn);
1029 1029
1030 RCU_INIT_POINTER(t->trie, (struct rt_trie_node *)tn); 1030 rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
1031 tnode_free_flush(); 1031 tnode_free_flush();
1032} 1032}
1033 1033
@@ -1164,7 +1164,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
1164 put_child(t, (struct tnode *)tp, cindex, 1164 put_child(t, (struct tnode *)tp, cindex,
1165 (struct rt_trie_node *)tn); 1165 (struct rt_trie_node *)tn);
1166 } else { 1166 } else {
1167 RCU_INIT_POINTER(t->trie, (struct rt_trie_node *)tn); 1167 rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
1168 tp = tn; 1168 tp = tn;
1169 } 1169 }
1170 } 1170 }
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 5104bc0bbdbe..450e5d21ed2a 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1249,7 +1249,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
1249 1249
1250 im->next_rcu = in_dev->mc_list; 1250 im->next_rcu = in_dev->mc_list;
1251 in_dev->mc_count++; 1251 in_dev->mc_count++;
1252 RCU_INIT_POINTER(in_dev->mc_list, im); 1252 rcu_assign_pointer(in_dev->mc_list, im);
1253 1253
1254#ifdef CONFIG_IP_MULTICAST 1254#ifdef CONFIG_IP_MULTICAST
1255 igmpv3_del_delrec(in_dev, im->multiaddr); 1255 igmpv3_del_delrec(in_dev, im->multiaddr);
@@ -1821,7 +1821,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
1821 iml->next_rcu = inet->mc_list; 1821 iml->next_rcu = inet->mc_list;
1822 iml->sflist = NULL; 1822 iml->sflist = NULL;
1823 iml->sfmode = MCAST_EXCLUDE; 1823 iml->sfmode = MCAST_EXCLUDE;
1824 RCU_INIT_POINTER(inet->mc_list, iml); 1824 rcu_assign_pointer(inet->mc_list, iml);
1825 ip_mc_inc_group(in_dev, addr); 1825 ip_mc_inc_group(in_dev, addr);
1826 err = 0; 1826 err = 0;
1827done: 1827done:
@@ -2008,7 +2008,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
2008 atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc); 2008 atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
2009 kfree_rcu(psl, rcu); 2009 kfree_rcu(psl, rcu);
2010 } 2010 }
2011 RCU_INIT_POINTER(pmc->sflist, newpsl); 2011 rcu_assign_pointer(pmc->sflist, newpsl);
2012 psl = newpsl; 2012 psl = newpsl;
2013 } 2013 }
2014 rv = 1; /* > 0 for insert logic below if sl_count is 0 */ 2014 rv = 1; /* > 0 for insert logic below if sl_count is 0 */
@@ -2111,7 +2111,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
2111 } else 2111 } else
2112 (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode, 2112 (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
2113 0, NULL, 0); 2113 0, NULL, 0);
2114 RCU_INIT_POINTER(pmc->sflist, newpsl); 2114 rcu_assign_pointer(pmc->sflist, newpsl);
2115 pmc->sfmode = msf->imsf_fmode; 2115 pmc->sfmode = msf->imsf_fmode;
2116 err = 0; 2116 err = 0;
2117done: 2117done:
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 2240a8e8c44d..fcf281819cd4 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -71,7 +71,7 @@ static inline void inet_diag_unlock_handler(
71} 71}
72 72
73int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 73int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
74 struct sk_buff *skb, struct inet_diag_req *req, 74 struct sk_buff *skb, struct inet_diag_req_v2 *req,
75 u32 pid, u32 seq, u16 nlmsg_flags, 75 u32 pid, u32 seq, u16 nlmsg_flags,
76 const struct nlmsghdr *unlh) 76 const struct nlmsghdr *unlh)
77{ 77{
@@ -193,7 +193,7 @@ nlmsg_failure:
193EXPORT_SYMBOL_GPL(inet_sk_diag_fill); 193EXPORT_SYMBOL_GPL(inet_sk_diag_fill);
194 194
195static int inet_csk_diag_fill(struct sock *sk, 195static int inet_csk_diag_fill(struct sock *sk,
196 struct sk_buff *skb, struct inet_diag_req *req, 196 struct sk_buff *skb, struct inet_diag_req_v2 *req,
197 u32 pid, u32 seq, u16 nlmsg_flags, 197 u32 pid, u32 seq, u16 nlmsg_flags,
198 const struct nlmsghdr *unlh) 198 const struct nlmsghdr *unlh)
199{ 199{
@@ -202,7 +202,7 @@ static int inet_csk_diag_fill(struct sock *sk,
202} 202}
203 203
204static int inet_twsk_diag_fill(struct inet_timewait_sock *tw, 204static int inet_twsk_diag_fill(struct inet_timewait_sock *tw,
205 struct sk_buff *skb, struct inet_diag_req *req, 205 struct sk_buff *skb, struct inet_diag_req_v2 *req,
206 u32 pid, u32 seq, u16 nlmsg_flags, 206 u32 pid, u32 seq, u16 nlmsg_flags,
207 const struct nlmsghdr *unlh) 207 const struct nlmsghdr *unlh)
208{ 208{
@@ -253,7 +253,7 @@ nlmsg_failure:
253} 253}
254 254
255static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, 255static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
256 struct inet_diag_req *r, u32 pid, u32 seq, u16 nlmsg_flags, 256 struct inet_diag_req_v2 *r, u32 pid, u32 seq, u16 nlmsg_flags,
257 const struct nlmsghdr *unlh) 257 const struct nlmsghdr *unlh)
258{ 258{
259 if (sk->sk_state == TCP_TIME_WAIT) 259 if (sk->sk_state == TCP_TIME_WAIT)
@@ -264,7 +264,7 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb,
264} 264}
265 265
266int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_skb, 266int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_skb,
267 const struct nlmsghdr *nlh, struct inet_diag_req *req) 267 const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req)
268{ 268{
269 int err; 269 int err;
270 struct sock *sk; 270 struct sock *sk;
@@ -333,7 +333,7 @@ EXPORT_SYMBOL_GPL(inet_diag_dump_one_icsk);
333 333
334static int inet_diag_get_exact(struct sk_buff *in_skb, 334static int inet_diag_get_exact(struct sk_buff *in_skb,
335 const struct nlmsghdr *nlh, 335 const struct nlmsghdr *nlh,
336 struct inet_diag_req *req) 336 struct inet_diag_req_v2 *req)
337{ 337{
338 const struct inet_diag_handler *handler; 338 const struct inet_diag_handler *handler;
339 int err; 339 int err;
@@ -540,7 +540,7 @@ static int inet_diag_bc_audit(const void *bytecode, int bytecode_len)
540static int inet_csk_diag_dump(struct sock *sk, 540static int inet_csk_diag_dump(struct sock *sk,
541 struct sk_buff *skb, 541 struct sk_buff *skb,
542 struct netlink_callback *cb, 542 struct netlink_callback *cb,
543 struct inet_diag_req *r, 543 struct inet_diag_req_v2 *r,
544 const struct nlattr *bc) 544 const struct nlattr *bc)
545{ 545{
546 if (!inet_diag_bc_sk(bc, sk)) 546 if (!inet_diag_bc_sk(bc, sk))
@@ -554,7 +554,7 @@ static int inet_csk_diag_dump(struct sock *sk,
554static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, 554static int inet_twsk_diag_dump(struct inet_timewait_sock *tw,
555 struct sk_buff *skb, 555 struct sk_buff *skb,
556 struct netlink_callback *cb, 556 struct netlink_callback *cb,
557 struct inet_diag_req *r, 557 struct inet_diag_req_v2 *r,
558 const struct nlattr *bc) 558 const struct nlattr *bc)
559{ 559{
560 if (bc != NULL) { 560 if (bc != NULL) {
@@ -639,7 +639,7 @@ nlmsg_failure:
639 639
640static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, 640static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk,
641 struct netlink_callback *cb, 641 struct netlink_callback *cb,
642 struct inet_diag_req *r, 642 struct inet_diag_req_v2 *r,
643 const struct nlattr *bc) 643 const struct nlattr *bc)
644{ 644{
645 struct inet_diag_entry entry; 645 struct inet_diag_entry entry;
@@ -721,7 +721,7 @@ out:
721} 721}
722 722
723void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, 723void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb,
724 struct netlink_callback *cb, struct inet_diag_req *r, struct nlattr *bc) 724 struct netlink_callback *cb, struct inet_diag_req_v2 *r, struct nlattr *bc)
725{ 725{
726 int i, num; 726 int i, num;
727 int s_i, s_num; 727 int s_i, s_num;
@@ -872,7 +872,7 @@ out:
872EXPORT_SYMBOL_GPL(inet_diag_dump_icsk); 872EXPORT_SYMBOL_GPL(inet_diag_dump_icsk);
873 873
874static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 874static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
875 struct inet_diag_req *r, struct nlattr *bc) 875 struct inet_diag_req_v2 *r, struct nlattr *bc)
876{ 876{
877 const struct inet_diag_handler *handler; 877 const struct inet_diag_handler *handler;
878 878
@@ -887,12 +887,12 @@ static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
887static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) 887static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
888{ 888{
889 struct nlattr *bc = NULL; 889 struct nlattr *bc = NULL;
890 int hdrlen = sizeof(struct inet_diag_req); 890 int hdrlen = sizeof(struct inet_diag_req_v2);
891 891
892 if (nlmsg_attrlen(cb->nlh, hdrlen)) 892 if (nlmsg_attrlen(cb->nlh, hdrlen))
893 bc = nlmsg_find_attr(cb->nlh, hdrlen, INET_DIAG_REQ_BYTECODE); 893 bc = nlmsg_find_attr(cb->nlh, hdrlen, INET_DIAG_REQ_BYTECODE);
894 894
895 return __inet_diag_dump(skb, cb, (struct inet_diag_req *)NLMSG_DATA(cb->nlh), bc); 895 return __inet_diag_dump(skb, cb, (struct inet_diag_req_v2 *)NLMSG_DATA(cb->nlh), bc);
896} 896}
897 897
898static inline int inet_diag_type2proto(int type) 898static inline int inet_diag_type2proto(int type)
@@ -909,10 +909,10 @@ static inline int inet_diag_type2proto(int type)
909 909
910static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *cb) 910static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *cb)
911{ 911{
912 struct inet_diag_req_compat *rc = NLMSG_DATA(cb->nlh); 912 struct inet_diag_req *rc = NLMSG_DATA(cb->nlh);
913 struct inet_diag_req req; 913 struct inet_diag_req_v2 req;
914 struct nlattr *bc = NULL; 914 struct nlattr *bc = NULL;
915 int hdrlen = sizeof(struct inet_diag_req_compat); 915 int hdrlen = sizeof(struct inet_diag_req);
916 916
917 req.sdiag_family = AF_UNSPEC; /* compatibility */ 917 req.sdiag_family = AF_UNSPEC; /* compatibility */
918 req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type); 918 req.sdiag_protocol = inet_diag_type2proto(cb->nlh->nlmsg_type);
@@ -929,8 +929,8 @@ static int inet_diag_dump_compat(struct sk_buff *skb, struct netlink_callback *c
929static int inet_diag_get_exact_compat(struct sk_buff *in_skb, 929static int inet_diag_get_exact_compat(struct sk_buff *in_skb,
930 const struct nlmsghdr *nlh) 930 const struct nlmsghdr *nlh)
931{ 931{
932 struct inet_diag_req_compat *rc = NLMSG_DATA(nlh); 932 struct inet_diag_req *rc = NLMSG_DATA(nlh);
933 struct inet_diag_req req; 933 struct inet_diag_req_v2 req;
934 934
935 req.sdiag_family = rc->idiag_family; 935 req.sdiag_family = rc->idiag_family;
936 req.sdiag_protocol = inet_diag_type2proto(nlh->nlmsg_type); 936 req.sdiag_protocol = inet_diag_type2proto(nlh->nlmsg_type);
@@ -943,7 +943,7 @@ static int inet_diag_get_exact_compat(struct sk_buff *in_skb,
943 943
944static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh) 944static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
945{ 945{
946 int hdrlen = sizeof(struct inet_diag_req_compat); 946 int hdrlen = sizeof(struct inet_diag_req);
947 947
948 if (nlh->nlmsg_type >= INET_DIAG_GETSOCK_MAX || 948 if (nlh->nlmsg_type >= INET_DIAG_GETSOCK_MAX ||
949 nlmsg_len(nlh) < hdrlen) 949 nlmsg_len(nlh) < hdrlen)
@@ -970,7 +970,7 @@ static int inet_diag_rcv_msg_compat(struct sk_buff *skb, struct nlmsghdr *nlh)
970 970
971static int inet_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h) 971static int inet_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
972{ 972{
973 int hdrlen = sizeof(struct inet_diag_req); 973 int hdrlen = sizeof(struct inet_diag_req_v2);
974 974
975 if (nlmsg_len(h) < hdrlen) 975 if (nlmsg_len(h) < hdrlen)
976 return -EINVAL; 976 return -EINVAL;
@@ -990,7 +990,7 @@ static int inet_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h)
990 inet_diag_dump, NULL, 0); 990 inet_diag_dump, NULL, 0);
991 } 991 }
992 992
993 return inet_diag_get_exact(skb, h, (struct inet_diag_req *)NLMSG_DATA(h)); 993 return inet_diag_get_exact(skb, h, (struct inet_diag_req_v2 *)NLMSG_DATA(h));
994} 994}
995 995
996static struct sock_diag_handler inet_diag_handler = { 996static struct sock_diag_handler inet_diag_handler = {
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 413ed1ba7a5a..22a199315309 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -231,7 +231,7 @@ static void ipip_tunnel_unlink(struct ipip_net *ipn, struct ip_tunnel *t)
231 (iter = rtnl_dereference(*tp)) != NULL; 231 (iter = rtnl_dereference(*tp)) != NULL;
232 tp = &iter->next) { 232 tp = &iter->next) {
233 if (t == iter) { 233 if (t == iter) {
234 RCU_INIT_POINTER(*tp, t->next); 234 rcu_assign_pointer(*tp, t->next);
235 break; 235 break;
236 } 236 }
237 } 237 }
@@ -241,8 +241,8 @@ static void ipip_tunnel_link(struct ipip_net *ipn, struct ip_tunnel *t)
241{ 241{
242 struct ip_tunnel __rcu **tp = ipip_bucket(ipn, t); 242 struct ip_tunnel __rcu **tp = ipip_bucket(ipn, t);
243 243
244 RCU_INIT_POINTER(t->next, rtnl_dereference(*tp)); 244 rcu_assign_pointer(t->next, rtnl_dereference(*tp));
245 RCU_INIT_POINTER(*tp, t); 245 rcu_assign_pointer(*tp, t);
246} 246}
247 247
248static struct ip_tunnel * ipip_tunnel_locate(struct net *net, 248static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
@@ -792,7 +792,7 @@ static int __net_init ipip_fb_tunnel_init(struct net_device *dev)
792 return -ENOMEM; 792 return -ENOMEM;
793 793
794 dev_hold(dev); 794 dev_hold(dev);
795 RCU_INIT_POINTER(ipn->tunnels_wc[0], tunnel); 795 rcu_assign_pointer(ipn->tunnels_wc[0], tunnel);
796 return 0; 796 return 0;
797} 797}
798 798
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 8e54490ee3f4..7bc2db6db8d4 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1225,7 +1225,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi
1225 1225
1226 ret = ip_ra_control(sk, 1, mrtsock_destruct); 1226 ret = ip_ra_control(sk, 1, mrtsock_destruct);
1227 if (ret == 0) { 1227 if (ret == 0) {
1228 RCU_INIT_POINTER(mrt->mroute_sk, sk); 1228 rcu_assign_pointer(mrt->mroute_sk, sk);
1229 IPV4_DEVCONF_ALL(net, MC_FORWARDING)++; 1229 IPV4_DEVCONF_ALL(net, MC_FORWARDING)++;
1230 } 1230 }
1231 rtnl_unlock(); 1231 rtnl_unlock();
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 8cd357a8be79..ed3f2ad42e0f 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -35,13 +35,13 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
35} 35}
36 36
37static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 37static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
38 struct inet_diag_req *r, struct nlattr *bc) 38 struct inet_diag_req_v2 *r, struct nlattr *bc)
39{ 39{
40 inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc); 40 inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc);
41} 41}
42 42
43static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 43static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
44 struct inet_diag_req *req) 44 struct inet_diag_req_v2 *req)
45{ 45{
46 return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req); 46 return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req);
47} 47}
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c
index 7fed04f875c1..49978788a9dc 100644
--- a/net/ipv4/tcp_memcontrol.c
+++ b/net/ipv4/tcp_memcontrol.c
@@ -108,7 +108,7 @@ void tcp_destroy_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss)
108 tcp = tcp_from_cgproto(cg_proto); 108 tcp = tcp_from_cgproto(cg_proto);
109 percpu_counter_destroy(&tcp->tcp_sockets_allocated); 109 percpu_counter_destroy(&tcp->tcp_sockets_allocated);
110 110
111 val = res_counter_read_u64(&tcp->tcp_memory_allocated, RES_USAGE); 111 val = res_counter_read_u64(&tcp->tcp_memory_allocated, RES_LIMIT);
112 112
113 if (val != RESOURCE_MAX) 113 if (val != RESOURCE_MAX)
114 jump_label_dec(&memcg_socket_limit_enabled); 114 jump_label_dec(&memcg_socket_limit_enabled);
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 69f8a7ca63dd..e5e18cb8a586 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -19,7 +19,7 @@
19#include <linux/sock_diag.h> 19#include <linux/sock_diag.h>
20 20
21static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, 21static int sk_diag_dump(struct sock *sk, struct sk_buff *skb,
22 struct netlink_callback *cb, struct inet_diag_req *req, 22 struct netlink_callback *cb, struct inet_diag_req_v2 *req,
23 struct nlattr *bc) 23 struct nlattr *bc)
24{ 24{
25 if (!inet_diag_bc_sk(bc, sk)) 25 if (!inet_diag_bc_sk(bc, sk))
@@ -30,7 +30,7 @@ static int sk_diag_dump(struct sock *sk, struct sk_buff *skb,
30} 30}
31 31
32static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb, 32static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb,
33 const struct nlmsghdr *nlh, struct inet_diag_req *req) 33 const struct nlmsghdr *nlh, struct inet_diag_req_v2 *req)
34{ 34{
35 int err = -EINVAL; 35 int err = -EINVAL;
36 struct sock *sk; 36 struct sock *sk;
@@ -88,7 +88,7 @@ out_nosk:
88} 88}
89 89
90static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlink_callback *cb, 90static void udp_dump(struct udp_table *table, struct sk_buff *skb, struct netlink_callback *cb,
91 struct inet_diag_req *r, struct nlattr *bc) 91 struct inet_diag_req_v2 *r, struct nlattr *bc)
92{ 92{
93 int num, s_num, slot, s_slot; 93 int num, s_num, slot, s_slot;
94 94
@@ -136,13 +136,13 @@ done:
136} 136}
137 137
138static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 138static void udp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
139 struct inet_diag_req *r, struct nlattr *bc) 139 struct inet_diag_req_v2 *r, struct nlattr *bc)
140{ 140{
141 udp_dump(&udp_table, skb, cb, r, bc); 141 udp_dump(&udp_table, skb, cb, r, bc);
142} 142}
143 143
144static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 144static int udp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
145 struct inet_diag_req *req) 145 struct inet_diag_req_v2 *req)
146{ 146{
147 return udp_dump_one(&udp_table, in_skb, nlh, req); 147 return udp_dump_one(&udp_table, in_skb, nlh, req);
148} 148}
@@ -154,13 +154,13 @@ static const struct inet_diag_handler udp_diag_handler = {
154}; 154};
155 155
156static void udplite_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 156static void udplite_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
157 struct inet_diag_req *r, struct nlattr *bc) 157 struct inet_diag_req_v2 *r, struct nlattr *bc)
158{ 158{
159 udp_dump(&udplite_table, skb, cb, r, bc); 159 udp_dump(&udplite_table, skb, cb, r, bc);
160} 160}
161 161
162static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, 162static int udplite_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
163 struct inet_diag_req *req) 163 struct inet_diag_req_v2 *req)
164{ 164{
165 return udp_dump_one(&udplite_table, in_skb, nlh, req); 165 return udp_dump_one(&udplite_table, in_skb, nlh, req);
166} 166}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0ba0866230c9..a225d5ee3c2f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -429,7 +429,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
429 ndev->tstamp = jiffies; 429 ndev->tstamp = jiffies;
430 addrconf_sysctl_register(ndev); 430 addrconf_sysctl_register(ndev);
431 /* protected by rtnl_lock */ 431 /* protected by rtnl_lock */
432 RCU_INIT_POINTER(dev->ip6_ptr, ndev); 432 rcu_assign_pointer(dev->ip6_ptr, ndev);
433 433
434 /* Join all-node multicast group */ 434 /* Join all-node multicast group */
435 ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes); 435 ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index e1f7761815f3..aa21da6a09cd 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -218,8 +218,8 @@ ip6_tnl_link(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
218{ 218{
219 struct ip6_tnl __rcu **tp = ip6_tnl_bucket(ip6n, &t->parms); 219 struct ip6_tnl __rcu **tp = ip6_tnl_bucket(ip6n, &t->parms);
220 220
221 RCU_INIT_POINTER(t->next , rtnl_dereference(*tp)); 221 rcu_assign_pointer(t->next , rtnl_dereference(*tp));
222 RCU_INIT_POINTER(*tp, t); 222 rcu_assign_pointer(*tp, t);
223} 223}
224 224
225/** 225/**
@@ -237,7 +237,7 @@ ip6_tnl_unlink(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
237 (iter = rtnl_dereference(*tp)) != NULL; 237 (iter = rtnl_dereference(*tp)) != NULL;
238 tp = &iter->next) { 238 tp = &iter->next) {
239 if (t == iter) { 239 if (t == iter) {
240 RCU_INIT_POINTER(*tp, t->next); 240 rcu_assign_pointer(*tp, t->next);
241 break; 241 break;
242 } 242 }
243 } 243 }
@@ -1450,7 +1450,7 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
1450 1450
1451 t->parms.proto = IPPROTO_IPV6; 1451 t->parms.proto = IPPROTO_IPV6;
1452 dev_hold(dev); 1452 dev_hold(dev);
1453 RCU_INIT_POINTER(ip6n->tnls_wc[0], t); 1453 rcu_assign_pointer(ip6n->tnls_wc[0], t);
1454 return 0; 1454 return 0;
1455} 1455}
1456 1456
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index a4894f4f1944..d02f7e4dd611 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -131,7 +131,7 @@ static mh_filter_t __rcu *mh_filter __read_mostly;
131 131
132int rawv6_mh_filter_register(mh_filter_t filter) 132int rawv6_mh_filter_register(mh_filter_t filter)
133{ 133{
134 RCU_INIT_POINTER(mh_filter, filter); 134 rcu_assign_pointer(mh_filter, filter);
135 return 0; 135 return 0;
136} 136}
137EXPORT_SYMBOL(rawv6_mh_filter_register); 137EXPORT_SYMBOL(rawv6_mh_filter_register);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3b6dac956bb0..133768e52912 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -182,7 +182,7 @@ static void ipip6_tunnel_unlink(struct sit_net *sitn, struct ip_tunnel *t)
182 (iter = rtnl_dereference(*tp)) != NULL; 182 (iter = rtnl_dereference(*tp)) != NULL;
183 tp = &iter->next) { 183 tp = &iter->next) {
184 if (t == iter) { 184 if (t == iter) {
185 RCU_INIT_POINTER(*tp, t->next); 185 rcu_assign_pointer(*tp, t->next);
186 break; 186 break;
187 } 187 }
188 } 188 }
@@ -192,8 +192,8 @@ static void ipip6_tunnel_link(struct sit_net *sitn, struct ip_tunnel *t)
192{ 192{
193 struct ip_tunnel __rcu **tp = ipip6_bucket(sitn, t); 193 struct ip_tunnel __rcu **tp = ipip6_bucket(sitn, t);
194 194
195 RCU_INIT_POINTER(t->next, rtnl_dereference(*tp)); 195 rcu_assign_pointer(t->next, rtnl_dereference(*tp));
196 RCU_INIT_POINTER(*tp, t); 196 rcu_assign_pointer(*tp, t);
197} 197}
198 198
199static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn) 199static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn)
@@ -393,7 +393,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
393 p->addr = a->addr; 393 p->addr = a->addr;
394 p->flags = a->flags; 394 p->flags = a->flags;
395 t->prl_count++; 395 t->prl_count++;
396 RCU_INIT_POINTER(t->prl, p); 396 rcu_assign_pointer(t->prl, p);
397out: 397out:
398 return err; 398 return err;
399} 399}
@@ -1177,7 +1177,7 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
1177 if (!dev->tstats) 1177 if (!dev->tstats)
1178 return -ENOMEM; 1178 return -ENOMEM;
1179 dev_hold(dev); 1179 dev_hold(dev);
1180 RCU_INIT_POINTER(sitn->tunnels_wc[0], tunnel); 1180 rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
1181 return 0; 1181 return 0;
1182} 1182}
1183 1183
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 96debba2c407..1068f668ac4e 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -332,7 +332,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
332 status = WLAN_STATUS_SUCCESS; 332 status = WLAN_STATUS_SUCCESS;
333 333
334 /* activate it for RX */ 334 /* activate it for RX */
335 RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx); 335 rcu_assign_pointer(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx);
336 336
337 if (timeout) 337 if (timeout)
338 mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout)); 338 mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout));
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 850bb96bd680..e60df48fa4d4 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -616,7 +616,7 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
616 616
617 sdata->vif.bss_conf.dtim_period = new->dtim_period; 617 sdata->vif.bss_conf.dtim_period = new->dtim_period;
618 618
619 RCU_INIT_POINTER(sdata->u.ap.beacon, new); 619 rcu_assign_pointer(sdata->u.ap.beacon, new);
620 620
621 synchronize_rcu(); 621 synchronize_rcu();
622 622
@@ -1033,7 +1033,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
1033 return -EBUSY; 1033 return -EBUSY;
1034 } 1034 }
1035 1035
1036 RCU_INIT_POINTER(vlansdata->u.vlan.sta, sta); 1036 rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
1037 } 1037 }
1038 1038
1039 sta->sdata = vlansdata; 1039 sta->sdata = vlansdata;
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index f8a32bf98216..b3d76b756cd5 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -207,7 +207,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
207 *pos++ = 0; /* U-APSD no in use */ 207 *pos++ = 0; /* U-APSD no in use */
208 } 208 }
209 209
210 RCU_INIT_POINTER(ifibss->presp, skb); 210 rcu_assign_pointer(ifibss->presp, skb);
211 211
212 sdata->vif.bss_conf.beacon_int = beacon_int; 212 sdata->vif.bss_conf.beacon_int = beacon_int;
213 sdata->vif.bss_conf.basic_rates = basic_rates; 213 sdata->vif.bss_conf.basic_rates = basic_rates;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index b197136aea2c..3c428d4839c7 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -73,7 +73,7 @@ static int sta_info_hash_del(struct ieee80211_local *local,
73 if (!s) 73 if (!s)
74 return -ENOENT; 74 return -ENOENT;
75 if (s == sta) { 75 if (s == sta) {
76 RCU_INIT_POINTER(local->sta_hash[STA_HASH(sta->sta.addr)], 76 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)],
77 s->hnext); 77 s->hnext);
78 return 0; 78 return 0;
79 } 79 }
@@ -83,7 +83,7 @@ static int sta_info_hash_del(struct ieee80211_local *local,
83 s = rcu_dereference_protected(s->hnext, 83 s = rcu_dereference_protected(s->hnext,
84 lockdep_is_held(&local->sta_mtx)); 84 lockdep_is_held(&local->sta_mtx));
85 if (rcu_access_pointer(s->hnext)) { 85 if (rcu_access_pointer(s->hnext)) {
86 RCU_INIT_POINTER(s->hnext, sta->hnext); 86 rcu_assign_pointer(s->hnext, sta->hnext);
87 return 0; 87 return 0;
88 } 88 }
89 89
@@ -226,7 +226,7 @@ static void sta_info_hash_add(struct ieee80211_local *local,
226{ 226{
227 lockdep_assert_held(&local->sta_mtx); 227 lockdep_assert_held(&local->sta_mtx);
228 sta->hnext = local->sta_hash[STA_HASH(sta->sta.addr)]; 228 sta->hnext = local->sta_hash[STA_HASH(sta->sta.addr)];
229 RCU_INIT_POINTER(local->sta_hash[STA_HASH(sta->sta.addr)], sta); 229 rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
230} 230}
231 231
232static void sta_unblock(struct work_struct *wk) 232static void sta_unblock(struct work_struct *wk)
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 93aab0715e8a..422b79851ec5 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -106,7 +106,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
106 if (status->flag & RX_FLAG_MMIC_ERROR) 106 if (status->flag & RX_FLAG_MMIC_ERROR)
107 goto mic_fail; 107 goto mic_fail;
108 108
109 if (!(status->flag & RX_FLAG_IV_STRIPPED)) 109 if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key)
110 goto update_iv; 110 goto update_iv;
111 111
112 return RX_CONTINUE; 112 return RX_CONTINUE;
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index e875f8902db3..76613f5a55c0 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -777,7 +777,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
777 if (exp->helper) { 777 if (exp->helper) {
778 help = nf_ct_helper_ext_add(ct, GFP_ATOMIC); 778 help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
779 if (help) 779 if (help)
780 RCU_INIT_POINTER(help->helper, exp->helper); 780 rcu_assign_pointer(help->helper, exp->helper);
781 } 781 }
782 782
783#ifdef CONFIG_NF_CONNTRACK_MARK 783#ifdef CONFIG_NF_CONNTRACK_MARK
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index b62c4148b921..14af6329bdda 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -91,7 +91,7 @@ int nf_conntrack_register_notifier(struct net *net,
91 ret = -EBUSY; 91 ret = -EBUSY;
92 goto out_unlock; 92 goto out_unlock;
93 } 93 }
94 RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new); 94 rcu_assign_pointer(net->ct.nf_conntrack_event_cb, new);
95 mutex_unlock(&nf_ct_ecache_mutex); 95 mutex_unlock(&nf_ct_ecache_mutex);
96 return ret; 96 return ret;
97 97
@@ -128,7 +128,7 @@ int nf_ct_expect_register_notifier(struct net *net,
128 ret = -EBUSY; 128 ret = -EBUSY;
129 goto out_unlock; 129 goto out_unlock;
130 } 130 }
131 RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new); 131 rcu_assign_pointer(net->ct.nf_expect_event_cb, new);
132 mutex_unlock(&nf_ct_ecache_mutex); 132 mutex_unlock(&nf_ct_ecache_mutex);
133 return ret; 133 return ret;
134 134
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
index 4605c947dcc4..641ff5f96718 100644
--- a/net/netfilter/nf_conntrack_extend.c
+++ b/net/netfilter/nf_conntrack_extend.c
@@ -169,7 +169,7 @@ int nf_ct_extend_register(struct nf_ct_ext_type *type)
169 before updating alloc_size */ 169 before updating alloc_size */
170 type->alloc_size = ALIGN(sizeof(struct nf_ct_ext), type->align) 170 type->alloc_size = ALIGN(sizeof(struct nf_ct_ext), type->align)
171 + type->len; 171 + type->len;
172 RCU_INIT_POINTER(nf_ct_ext_types[type->id], type); 172 rcu_assign_pointer(nf_ct_ext_types[type->id], type);
173 update_alloc_size(type); 173 update_alloc_size(type);
174out: 174out:
175 mutex_unlock(&nf_ct_ext_type_mutex); 175 mutex_unlock(&nf_ct_ext_type_mutex);
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index c9e0de08aa87..299fec91f741 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -157,7 +157,7 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
157 memset(&help->help, 0, sizeof(help->help)); 157 memset(&help->help, 0, sizeof(help->help));
158 } 158 }
159 159
160 RCU_INIT_POINTER(help->helper, helper); 160 rcu_assign_pointer(help->helper, helper);
161out: 161out:
162 return ret; 162 return ret;
163} 163}
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index e07dc3ae930e..2a4834b83332 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1172,7 +1172,7 @@ ctnetlink_change_helper(struct nf_conn *ct, const struct nlattr * const cda[])
1172 return -EOPNOTSUPP; 1172 return -EOPNOTSUPP;
1173 } 1173 }
1174 1174
1175 RCU_INIT_POINTER(help->helper, helper); 1175 rcu_assign_pointer(help->helper, helper);
1176 1176
1177 return 0; 1177 return 0;
1178} 1178}
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index ce0c406f58a8..957374a234d4 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -55,7 +55,7 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
55 llog = rcu_dereference_protected(nf_loggers[pf], 55 llog = rcu_dereference_protected(nf_loggers[pf],
56 lockdep_is_held(&nf_log_mutex)); 56 lockdep_is_held(&nf_log_mutex));
57 if (llog == NULL) 57 if (llog == NULL)
58 RCU_INIT_POINTER(nf_loggers[pf], logger); 58 rcu_assign_pointer(nf_loggers[pf], logger);
59 } 59 }
60 60
61 mutex_unlock(&nf_log_mutex); 61 mutex_unlock(&nf_log_mutex);
@@ -92,7 +92,7 @@ int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger)
92 mutex_unlock(&nf_log_mutex); 92 mutex_unlock(&nf_log_mutex);
93 return -ENOENT; 93 return -ENOENT;
94 } 94 }
95 RCU_INIT_POINTER(nf_loggers[pf], logger); 95 rcu_assign_pointer(nf_loggers[pf], logger);
96 mutex_unlock(&nf_log_mutex); 96 mutex_unlock(&nf_log_mutex);
97 return 0; 97 return 0;
98} 98}
@@ -250,7 +250,7 @@ static int nf_log_proc_dostring(ctl_table *table, int write,
250 mutex_unlock(&nf_log_mutex); 250 mutex_unlock(&nf_log_mutex);
251 return -ENOENT; 251 return -ENOENT;
252 } 252 }
253 RCU_INIT_POINTER(nf_loggers[tindex], logger); 253 rcu_assign_pointer(nf_loggers[tindex], logger);
254 mutex_unlock(&nf_log_mutex); 254 mutex_unlock(&nf_log_mutex);
255 } else { 255 } else {
256 mutex_lock(&nf_log_mutex); 256 mutex_lock(&nf_log_mutex);
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index 99ffd2885088..b3a7db678b8d 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -40,7 +40,7 @@ int nf_register_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
40 else if (old) 40 else if (old)
41 ret = -EBUSY; 41 ret = -EBUSY;
42 else { 42 else {
43 RCU_INIT_POINTER(queue_handler[pf], qh); 43 rcu_assign_pointer(queue_handler[pf], qh);
44 ret = 0; 44 ret = 0;
45 } 45 }
46 mutex_unlock(&queue_handler_mutex); 46 mutex_unlock(&queue_handler_mutex);
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index c879c1a2370e..b4f8d849480c 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -59,7 +59,7 @@ int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
59 nfnl_unlock(); 59 nfnl_unlock();
60 return -EBUSY; 60 return -EBUSY;
61 } 61 }
62 RCU_INIT_POINTER(subsys_table[n->subsys_id], n); 62 rcu_assign_pointer(subsys_table[n->subsys_id], n);
63 nfnl_unlock(); 63 nfnl_unlock();
64 64
65 return 0; 65 return 0;
@@ -210,7 +210,7 @@ static int __net_init nfnetlink_net_init(struct net *net)
210 if (!nfnl) 210 if (!nfnl)
211 return -ENOMEM; 211 return -ENOMEM;
212 net->nfnl_stash = nfnl; 212 net->nfnl_stash = nfnl;
213 RCU_INIT_POINTER(net->nfnl, nfnl); 213 rcu_assign_pointer(net->nfnl, nfnl);
214 return 0; 214 return 0;
215} 215}
216 216
diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index 38204112b9f4..d8d424337550 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -282,7 +282,7 @@ int __init netlbl_domhsh_init(u32 size)
282 INIT_LIST_HEAD(&hsh_tbl->tbl[iter]); 282 INIT_LIST_HEAD(&hsh_tbl->tbl[iter]);
283 283
284 spin_lock(&netlbl_domhsh_lock); 284 spin_lock(&netlbl_domhsh_lock);
285 RCU_INIT_POINTER(netlbl_domhsh, hsh_tbl); 285 rcu_assign_pointer(netlbl_domhsh, hsh_tbl);
286 spin_unlock(&netlbl_domhsh_lock); 286 spin_unlock(&netlbl_domhsh_lock);
287 287
288 return 0; 288 return 0;
@@ -330,7 +330,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
330 &rcu_dereference(netlbl_domhsh)->tbl[bkt]); 330 &rcu_dereference(netlbl_domhsh)->tbl[bkt]);
331 } else { 331 } else {
332 INIT_LIST_HEAD(&entry->list); 332 INIT_LIST_HEAD(&entry->list);
333 RCU_INIT_POINTER(netlbl_domhsh_def, entry); 333 rcu_assign_pointer(netlbl_domhsh_def, entry);
334 } 334 }
335 335
336 if (entry->type == NETLBL_NLTYPE_ADDRSELECT) { 336 if (entry->type == NETLBL_NLTYPE_ADDRSELECT) {
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 4b5fa0fe78fd..e7ff694f1049 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -354,7 +354,7 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_add_iface(int ifindex)
354 INIT_LIST_HEAD(&iface->list); 354 INIT_LIST_HEAD(&iface->list);
355 if (netlbl_unlhsh_rcu_deref(netlbl_unlhsh_def) != NULL) 355 if (netlbl_unlhsh_rcu_deref(netlbl_unlhsh_def) != NULL)
356 goto add_iface_failure; 356 goto add_iface_failure;
357 RCU_INIT_POINTER(netlbl_unlhsh_def, iface); 357 rcu_assign_pointer(netlbl_unlhsh_def, iface);
358 } 358 }
359 spin_unlock(&netlbl_unlhsh_lock); 359 spin_unlock(&netlbl_unlhsh_lock);
360 360
@@ -1447,11 +1447,9 @@ int __init netlbl_unlabel_init(u32 size)
1447 for (iter = 0; iter < hsh_tbl->size; iter++) 1447 for (iter = 0; iter < hsh_tbl->size; iter++)
1448 INIT_LIST_HEAD(&hsh_tbl->tbl[iter]); 1448 INIT_LIST_HEAD(&hsh_tbl->tbl[iter]);
1449 1449
1450 rcu_read_lock();
1451 spin_lock(&netlbl_unlhsh_lock); 1450 spin_lock(&netlbl_unlhsh_lock);
1452 RCU_INIT_POINTER(netlbl_unlhsh, hsh_tbl); 1451 rcu_assign_pointer(netlbl_unlhsh, hsh_tbl);
1453 spin_unlock(&netlbl_unlhsh_lock); 1452 spin_unlock(&netlbl_unlhsh_lock);
1454 rcu_read_unlock();
1455 1453
1456 register_netdevice_notifier(&netlbl_unlhsh_netdev_notifier); 1454 register_netdevice_notifier(&netlbl_unlhsh_netdev_notifier);
1457 1455
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index bf10ea8fbbf9..d65f699fbf34 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -480,7 +480,7 @@ int __init_or_module phonet_proto_register(unsigned int protocol,
480 if (proto_tab[protocol]) 480 if (proto_tab[protocol])
481 err = -EBUSY; 481 err = -EBUSY;
482 else 482 else
483 RCU_INIT_POINTER(proto_tab[protocol], pp); 483 rcu_assign_pointer(proto_tab[protocol], pp);
484 mutex_unlock(&proto_tab_lock); 484 mutex_unlock(&proto_tab_lock);
485 485
486 return err; 486 return err;
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index c5827614376b..9b9a85ecc4c7 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -390,7 +390,7 @@ int phonet_route_add(struct net_device *dev, u8 daddr)
390 daddr = daddr >> 2; 390 daddr = daddr >> 2;
391 mutex_lock(&routes->lock); 391 mutex_lock(&routes->lock);
392 if (routes->table[daddr] == NULL) { 392 if (routes->table[daddr] == NULL) {
393 RCU_INIT_POINTER(routes->table[daddr], dev); 393 rcu_assign_pointer(routes->table[daddr], dev);
394 dev_hold(dev); 394 dev_hold(dev);
395 err = 0; 395 err = 0;
396 } 396 }
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 3f8d0b1603b9..4c7eff30dfa9 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -680,7 +680,7 @@ int pn_sock_bind_res(struct sock *sk, u8 res)
680 mutex_lock(&resource_mutex); 680 mutex_lock(&resource_mutex);
681 if (pnres.sk[res] == NULL) { 681 if (pnres.sk[res] == NULL) {
682 sock_hold(sk); 682 sock_hold(sk);
683 RCU_INIT_POINTER(pnres.sk[res], sk); 683 rcu_assign_pointer(pnres.sk[res], sk);
684 ret = 0; 684 ret = 0;
685 } 685 }
686 mutex_unlock(&resource_mutex); 686 mutex_unlock(&resource_mutex);
diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c
index 4e1de171866c..a817705ce2d0 100644
--- a/net/rds/iw_rdma.c
+++ b/net/rds/iw_rdma.c
@@ -477,17 +477,6 @@ void rds_iw_sync_mr(void *trans_private, int direction)
477 } 477 }
478} 478}
479 479
480static inline unsigned int rds_iw_flush_goal(struct rds_iw_mr_pool *pool, int free_all)
481{
482 unsigned int item_count;
483
484 item_count = atomic_read(&pool->item_count);
485 if (free_all)
486 return item_count;
487
488 return 0;
489}
490
491/* 480/*
492 * Flush our pool of MRs. 481 * Flush our pool of MRs.
493 * At a minimum, all currently unused MRs are unmapped. 482 * At a minimum, all currently unused MRs are unmapped.
@@ -500,7 +489,7 @@ static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all)
500 LIST_HEAD(unmap_list); 489 LIST_HEAD(unmap_list);
501 LIST_HEAD(kill_list); 490 LIST_HEAD(kill_list);
502 unsigned long flags; 491 unsigned long flags;
503 unsigned int nfreed = 0, ncleaned = 0, unpinned = 0, free_goal; 492 unsigned int nfreed = 0, ncleaned = 0, unpinned = 0;
504 int ret = 0; 493 int ret = 0;
505 494
506 rds_iw_stats_inc(s_iw_rdma_mr_pool_flush); 495 rds_iw_stats_inc(s_iw_rdma_mr_pool_flush);
@@ -514,8 +503,6 @@ static int rds_iw_flush_mr_pool(struct rds_iw_mr_pool *pool, int free_all)
514 list_splice_init(&pool->clean_list, &kill_list); 503 list_splice_init(&pool->clean_list, &kill_list);
515 spin_unlock_irqrestore(&pool->list_lock, flags); 504 spin_unlock_irqrestore(&pool->list_lock, flags);
516 505
517 free_goal = rds_iw_flush_goal(pool, free_all);
518
519 /* Batched invalidate of dirty MRs. 506 /* Batched invalidate of dirty MRs.
520 * For FMR based MRs, the mappings on the unmap list are 507 * For FMR based MRs, the mappings on the unmap list are
521 * actually members of an ibmr (ibmr->mapping). They either 508 * actually members of an ibmr (ibmr->mapping). They either
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 0a7964009e8c..67494aef9acf 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -24,6 +24,7 @@
24#include <net/netlink.h> 24#include <net/netlink.h>
25#include <net/pkt_sched.h> 25#include <net/pkt_sched.h>
26#include <net/flow_keys.h> 26#include <net/flow_keys.h>
27#include <net/red.h>
27 28
28 29
29/* Stochastic Fairness Queuing algorithm. 30/* Stochastic Fairness Queuing algorithm.
@@ -108,24 +109,30 @@ struct sfq_slot {
108 struct sfq_head dep; /* anchor in dep[] chains */ 109 struct sfq_head dep; /* anchor in dep[] chains */
109 unsigned short hash; /* hash value (index in ht[]) */ 110 unsigned short hash; /* hash value (index in ht[]) */
110 short allot; /* credit for this slot */ 111 short allot; /* credit for this slot */
112
113 unsigned int backlog;
114 struct red_vars vars;
111}; 115};
112 116
113struct sfq_sched_data { 117struct sfq_sched_data {
114/* frequently used fields */ 118/* frequently used fields */
115 int limit; /* limit of total number of packets in this qdisc */ 119 int limit; /* limit of total number of packets in this qdisc */
116 unsigned int divisor; /* number of slots in hash table */ 120 unsigned int divisor; /* number of slots in hash table */
117 unsigned int maxflows; /* number of flows in flows array */ 121 u8 headdrop;
118 int headdrop; 122 u8 maxdepth; /* limit of packets per flow */
119 int maxdepth; /* limit of packets per flow */
120 123
121 u32 perturbation; 124 u32 perturbation;
122 struct tcf_proto *filter_list; 125 u8 cur_depth; /* depth of longest slot */
123 sfq_index cur_depth; /* depth of longest slot */ 126 u8 flags;
124 unsigned short scaled_quantum; /* SFQ_ALLOT_SIZE(quantum) */ 127 unsigned short scaled_quantum; /* SFQ_ALLOT_SIZE(quantum) */
125 struct sfq_slot *tail; /* current slot in round */ 128 struct tcf_proto *filter_list;
126 sfq_index *ht; /* Hash table ('divisor' slots) */ 129 sfq_index *ht; /* Hash table ('divisor' slots) */
127 struct sfq_slot *slots; /* Flows table ('maxflows' entries) */ 130 struct sfq_slot *slots; /* Flows table ('maxflows' entries) */
128 131
132 struct red_parms *red_parms;
133 struct tc_sfqred_stats stats;
134 struct sfq_slot *tail; /* current slot in round */
135
129 struct sfq_head dep[SFQ_MAX_DEPTH + 1]; 136 struct sfq_head dep[SFQ_MAX_DEPTH + 1];
130 /* Linked lists of slots, indexed by depth 137 /* Linked lists of slots, indexed by depth
131 * dep[0] : list of unused flows 138 * dep[0] : list of unused flows
@@ -133,6 +140,7 @@ struct sfq_sched_data {
133 * dep[X] : list of flows with X packets 140 * dep[X] : list of flows with X packets
134 */ 141 */
135 142
143 unsigned int maxflows; /* number of flows in flows array */
136 int perturb_period; 144 int perturb_period;
137 unsigned int quantum; /* Allotment per round: MUST BE >= MTU */ 145 unsigned int quantum; /* Allotment per round: MUST BE >= MTU */
138 struct timer_list perturb_timer; 146 struct timer_list perturb_timer;
@@ -321,6 +329,7 @@ static unsigned int sfq_drop(struct Qdisc *sch)
321drop: 329drop:
322 skb = q->headdrop ? slot_dequeue_head(slot) : slot_dequeue_tail(slot); 330 skb = q->headdrop ? slot_dequeue_head(slot) : slot_dequeue_tail(slot);
323 len = qdisc_pkt_len(skb); 331 len = qdisc_pkt_len(skb);
332 slot->backlog -= len;
324 sfq_dec(q, x); 333 sfq_dec(q, x);
325 kfree_skb(skb); 334 kfree_skb(skb);
326 sch->q.qlen--; 335 sch->q.qlen--;
@@ -341,6 +350,23 @@ drop:
341 return 0; 350 return 0;
342} 351}
343 352
353/* Is ECN parameter configured */
354static int sfq_prob_mark(const struct sfq_sched_data *q)
355{
356 return q->flags & TC_RED_ECN;
357}
358
359/* Should packets over max threshold just be marked */
360static int sfq_hard_mark(const struct sfq_sched_data *q)
361{
362 return (q->flags & (TC_RED_ECN | TC_RED_HARDDROP)) == TC_RED_ECN;
363}
364
365static int sfq_headdrop(const struct sfq_sched_data *q)
366{
367 return q->headdrop;
368}
369
344static int 370static int
345sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) 371sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
346{ 372{
@@ -349,6 +375,8 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
349 sfq_index x, qlen; 375 sfq_index x, qlen;
350 struct sfq_slot *slot; 376 struct sfq_slot *slot;
351 int uninitialized_var(ret); 377 int uninitialized_var(ret);
378 struct sk_buff *head;
379 int delta;
352 380
353 hash = sfq_classify(skb, sch, &ret); 381 hash = sfq_classify(skb, sch, &ret);
354 if (hash == 0) { 382 if (hash == 0) {
@@ -368,24 +396,75 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
368 q->ht[hash] = x; 396 q->ht[hash] = x;
369 slot = &q->slots[x]; 397 slot = &q->slots[x];
370 slot->hash = hash; 398 slot->hash = hash;
399 slot->backlog = 0; /* should already be 0 anyway... */
400 red_set_vars(&slot->vars);
401 goto enqueue;
371 } 402 }
403 if (q->red_parms) {
404 slot->vars.qavg = red_calc_qavg_no_idle_time(q->red_parms,
405 &slot->vars,
406 slot->backlog);
407 switch (red_action(q->red_parms,
408 &slot->vars,
409 slot->vars.qavg)) {
410 case RED_DONT_MARK:
411 break;
372 412
373 if (slot->qlen >= q->maxdepth) { 413 case RED_PROB_MARK:
374 struct sk_buff *head; 414 sch->qstats.overlimits++;
415 if (sfq_prob_mark(q)) {
416 /* We know we have at least one packet in queue */
417 if (sfq_headdrop(q) &&
418 INET_ECN_set_ce(slot->skblist_next)) {
419 q->stats.prob_mark_head++;
420 break;
421 }
422 if (INET_ECN_set_ce(skb)) {
423 q->stats.prob_mark++;
424 break;
425 }
426 }
427 q->stats.prob_drop++;
428 goto congestion_drop;
429
430 case RED_HARD_MARK:
431 sch->qstats.overlimits++;
432 if (sfq_hard_mark(q)) {
433 /* We know we have at least one packet in queue */
434 if (sfq_headdrop(q) &&
435 INET_ECN_set_ce(slot->skblist_next)) {
436 q->stats.forced_mark_head++;
437 break;
438 }
439 if (INET_ECN_set_ce(skb)) {
440 q->stats.forced_mark++;
441 break;
442 }
443 }
444 q->stats.forced_drop++;
445 goto congestion_drop;
446 }
447 }
375 448
376 if (!q->headdrop) 449 if (slot->qlen >= q->maxdepth) {
450congestion_drop:
451 if (!sfq_headdrop(q))
377 return qdisc_drop(skb, sch); 452 return qdisc_drop(skb, sch);
378 453
454 /* We know we have at least one packet in queue */
379 head = slot_dequeue_head(slot); 455 head = slot_dequeue_head(slot);
380 sch->qstats.backlog -= qdisc_pkt_len(head); 456 delta = qdisc_pkt_len(head) - qdisc_pkt_len(skb);
457 sch->qstats.backlog -= delta;
458 slot->backlog -= delta;
381 qdisc_drop(head, sch); 459 qdisc_drop(head, sch);
382 460
383 sch->qstats.backlog += qdisc_pkt_len(skb);
384 slot_queue_add(slot, skb); 461 slot_queue_add(slot, skb);
385 return NET_XMIT_CN; 462 return NET_XMIT_CN;
386 } 463 }
387 464
465enqueue:
388 sch->qstats.backlog += qdisc_pkt_len(skb); 466 sch->qstats.backlog += qdisc_pkt_len(skb);
467 slot->backlog += qdisc_pkt_len(skb);
389 slot_queue_add(slot, skb); 468 slot_queue_add(slot, skb);
390 sfq_inc(q, x); 469 sfq_inc(q, x);
391 if (slot->qlen == 1) { /* The flow is new */ 470 if (slot->qlen == 1) { /* The flow is new */
@@ -396,6 +475,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
396 slot->next = q->tail->next; 475 slot->next = q->tail->next;
397 q->tail->next = x; 476 q->tail->next = x;
398 } 477 }
478 /* We could use a bigger initial quantum for new flows */
399 slot->allot = q->scaled_quantum; 479 slot->allot = q->scaled_quantum;
400 } 480 }
401 if (++sch->q.qlen <= q->limit) 481 if (++sch->q.qlen <= q->limit)
@@ -439,7 +519,7 @@ next_slot:
439 qdisc_bstats_update(sch, skb); 519 qdisc_bstats_update(sch, skb);
440 sch->q.qlen--; 520 sch->q.qlen--;
441 sch->qstats.backlog -= qdisc_pkt_len(skb); 521 sch->qstats.backlog -= qdisc_pkt_len(skb);
442 522 slot->backlog -= qdisc_pkt_len(skb);
443 /* Is the slot empty? */ 523 /* Is the slot empty? */
444 if (slot->qlen == 0) { 524 if (slot->qlen == 0) {
445 q->ht[slot->hash] = SFQ_EMPTY_SLOT; 525 q->ht[slot->hash] = SFQ_EMPTY_SLOT;
@@ -490,6 +570,8 @@ static void sfq_rehash(struct Qdisc *sch)
490 sfq_dec(q, i); 570 sfq_dec(q, i);
491 __skb_queue_tail(&list, skb); 571 __skb_queue_tail(&list, skb);
492 } 572 }
573 slot->backlog = 0;
574 red_set_vars(&slot->vars);
493 q->ht[slot->hash] = SFQ_EMPTY_SLOT; 575 q->ht[slot->hash] = SFQ_EMPTY_SLOT;
494 } 576 }
495 q->tail = NULL; 577 q->tail = NULL;
@@ -514,6 +596,11 @@ drop: sch->qstats.backlog -= qdisc_pkt_len(skb);
514 if (slot->qlen >= q->maxdepth) 596 if (slot->qlen >= q->maxdepth)
515 goto drop; 597 goto drop;
516 slot_queue_add(slot, skb); 598 slot_queue_add(slot, skb);
599 if (q->red_parms)
600 slot->vars.qavg = red_calc_qavg(q->red_parms,
601 &slot->vars,
602 slot->backlog);
603 slot->backlog += qdisc_pkt_len(skb);
517 sfq_inc(q, x); 604 sfq_inc(q, x);
518 if (slot->qlen == 1) { /* The flow is new */ 605 if (slot->qlen == 1) { /* The flow is new */
519 if (q->tail == NULL) { /* It is the first flow */ 606 if (q->tail == NULL) { /* It is the first flow */
@@ -552,6 +639,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
552 struct tc_sfq_qopt *ctl = nla_data(opt); 639 struct tc_sfq_qopt *ctl = nla_data(opt);
553 struct tc_sfq_qopt_v1 *ctl_v1 = NULL; 640 struct tc_sfq_qopt_v1 *ctl_v1 = NULL;
554 unsigned int qlen; 641 unsigned int qlen;
642 struct red_parms *p = NULL;
555 643
556 if (opt->nla_len < nla_attr_size(sizeof(*ctl))) 644 if (opt->nla_len < nla_attr_size(sizeof(*ctl)))
557 return -EINVAL; 645 return -EINVAL;
@@ -560,7 +648,11 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
560 if (ctl->divisor && 648 if (ctl->divisor &&
561 (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536)) 649 (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536))
562 return -EINVAL; 650 return -EINVAL;
563 651 if (ctl_v1 && ctl_v1->qth_min) {
652 p = kmalloc(sizeof(*p), GFP_KERNEL);
653 if (!p)
654 return -ENOMEM;
655 }
564 sch_tree_lock(sch); 656 sch_tree_lock(sch);
565 if (ctl->quantum) { 657 if (ctl->quantum) {
566 q->quantum = ctl->quantum; 658 q->quantum = ctl->quantum;
@@ -576,6 +668,16 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
576 if (ctl_v1) { 668 if (ctl_v1) {
577 if (ctl_v1->depth) 669 if (ctl_v1->depth)
578 q->maxdepth = min_t(u32, ctl_v1->depth, SFQ_MAX_DEPTH); 670 q->maxdepth = min_t(u32, ctl_v1->depth, SFQ_MAX_DEPTH);
671 if (p) {
672 swap(q->red_parms, p);
673 red_set_parms(q->red_parms,
674 ctl_v1->qth_min, ctl_v1->qth_max,
675 ctl_v1->Wlog,
676 ctl_v1->Plog, ctl_v1->Scell_log,
677 NULL,
678 ctl_v1->max_P);
679 }
680 q->flags = ctl_v1->flags;
579 q->headdrop = ctl_v1->headdrop; 681 q->headdrop = ctl_v1->headdrop;
580 } 682 }
581 if (ctl->limit) { 683 if (ctl->limit) {
@@ -594,6 +696,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt)
594 q->perturbation = net_random(); 696 q->perturbation = net_random();
595 } 697 }
596 sch_tree_unlock(sch); 698 sch_tree_unlock(sch);
699 kfree(p);
597 return 0; 700 return 0;
598} 701}
599 702
@@ -625,6 +728,7 @@ static void sfq_destroy(struct Qdisc *sch)
625 del_timer_sync(&q->perturb_timer); 728 del_timer_sync(&q->perturb_timer);
626 sfq_free(q->ht); 729 sfq_free(q->ht);
627 sfq_free(q->slots); 730 sfq_free(q->slots);
731 kfree(q->red_parms);
628} 732}
629 733
630static int sfq_init(struct Qdisc *sch, struct nlattr *opt) 734static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
@@ -683,6 +787,7 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
683 struct sfq_sched_data *q = qdisc_priv(sch); 787 struct sfq_sched_data *q = qdisc_priv(sch);
684 unsigned char *b = skb_tail_pointer(skb); 788 unsigned char *b = skb_tail_pointer(skb);
685 struct tc_sfq_qopt_v1 opt; 789 struct tc_sfq_qopt_v1 opt;
790 struct red_parms *p = q->red_parms;
686 791
687 memset(&opt, 0, sizeof(opt)); 792 memset(&opt, 0, sizeof(opt));
688 opt.v0.quantum = q->quantum; 793 opt.v0.quantum = q->quantum;
@@ -693,6 +798,17 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
693 opt.depth = q->maxdepth; 798 opt.depth = q->maxdepth;
694 opt.headdrop = q->headdrop; 799 opt.headdrop = q->headdrop;
695 800
801 if (p) {
802 opt.qth_min = p->qth_min >> p->Wlog;
803 opt.qth_max = p->qth_max >> p->Wlog;
804 opt.Wlog = p->Wlog;
805 opt.Plog = p->Plog;
806 opt.Scell_log = p->Scell_log;
807 opt.max_P = p->max_P;
808 }
809 memcpy(&opt.stats, &q->stats, sizeof(opt.stats));
810 opt.flags = q->flags;
811
696 NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); 812 NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
697 813
698 return skb->len; 814 return skb->len;
@@ -747,15 +863,13 @@ static int sfq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
747 sfq_index idx = q->ht[cl - 1]; 863 sfq_index idx = q->ht[cl - 1];
748 struct gnet_stats_queue qs = { 0 }; 864 struct gnet_stats_queue qs = { 0 };
749 struct tc_sfq_xstats xstats = { 0 }; 865 struct tc_sfq_xstats xstats = { 0 };
750 struct sk_buff *skb;
751 866
752 if (idx != SFQ_EMPTY_SLOT) { 867 if (idx != SFQ_EMPTY_SLOT) {
753 const struct sfq_slot *slot = &q->slots[idx]; 868 const struct sfq_slot *slot = &q->slots[idx];
754 869
755 xstats.allot = slot->allot << SFQ_ALLOT_SHIFT; 870 xstats.allot = slot->allot << SFQ_ALLOT_SHIFT;
756 qs.qlen = slot->qlen; 871 qs.qlen = slot->qlen;
757 slot_queue_walk(slot, skb) 872 qs.backlog = slot->backlog;
758 qs.backlog += qdisc_pkt_len(skb);
759 } 873 }
760 if (gnet_stats_copy_queue(d, &qs) < 0) 874 if (gnet_stats_copy_queue(d, &qs) < 0)
761 return -1; 875 return -1;
diff --git a/net/socket.c b/net/socket.c
index e56162cd65b0..28a96af484b4 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2492,7 +2492,7 @@ int sock_register(const struct net_proto_family *ops)
2492 lockdep_is_held(&net_family_lock))) 2492 lockdep_is_held(&net_family_lock)))
2493 err = -EEXIST; 2493 err = -EEXIST;
2494 else { 2494 else {
2495 RCU_INIT_POINTER(net_families[ops->family], ops); 2495 rcu_assign_pointer(net_families[ops->family], ops);
2496 err = 0; 2496 err = 0;
2497 } 2497 }
2498 spin_unlock(&net_family_lock); 2498 spin_unlock(&net_family_lock);
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 28d72d298735..affa631ac1ab 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -122,7 +122,7 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
122 if (!test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags)) 122 if (!test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags))
123 return; 123 return;
124 gss_get_ctx(ctx); 124 gss_get_ctx(ctx);
125 RCU_INIT_POINTER(gss_cred->gc_ctx, ctx); 125 rcu_assign_pointer(gss_cred->gc_ctx, ctx);
126 set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags); 126 set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
127 smp_mb__before_clear_bit(); 127 smp_mb__before_clear_bit();
128 clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags); 128 clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b3d3cf8931cb..afeea32e04ad 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2250,6 +2250,7 @@ static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = {
2250}; 2250};
2251 2251
2252static int parse_station_flags(struct genl_info *info, 2252static int parse_station_flags(struct genl_info *info,
2253 enum nl80211_iftype iftype,
2253 struct station_parameters *params) 2254 struct station_parameters *params)
2254{ 2255{
2255 struct nlattr *flags[NL80211_STA_FLAG_MAX + 1]; 2256 struct nlattr *flags[NL80211_STA_FLAG_MAX + 1];
@@ -2283,8 +2284,33 @@ static int parse_station_flags(struct genl_info *info,
2283 nla, sta_flags_policy)) 2284 nla, sta_flags_policy))
2284 return -EINVAL; 2285 return -EINVAL;
2285 2286
2286 params->sta_flags_mask = (1 << __NL80211_STA_FLAG_AFTER_LAST) - 1; 2287 /*
2287 params->sta_flags_mask &= ~1; 2288 * Only allow certain flags for interface types so that
2289 * other attributes are silently ignored. Remember that
2290 * this is backward compatibility code with old userspace
2291 * and shouldn't be hit in other cases anyway.
2292 */
2293 switch (iftype) {
2294 case NL80211_IFTYPE_AP:
2295 case NL80211_IFTYPE_AP_VLAN:
2296 case NL80211_IFTYPE_P2P_GO:
2297 params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
2298 BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) |
2299 BIT(NL80211_STA_FLAG_WME) |
2300 BIT(NL80211_STA_FLAG_MFP);
2301 break;
2302 case NL80211_IFTYPE_P2P_CLIENT:
2303 case NL80211_IFTYPE_STATION:
2304 params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) |
2305 BIT(NL80211_STA_FLAG_TDLS_PEER);
2306 break;
2307 case NL80211_IFTYPE_MESH_POINT:
2308 params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) |
2309 BIT(NL80211_STA_FLAG_MFP) |
2310 BIT(NL80211_STA_FLAG_AUTHORIZED);
2311 default:
2312 return -EINVAL;
2313 }
2288 2314
2289 for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) 2315 for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++)
2290 if (flags[flag]) 2316 if (flags[flag])
@@ -2585,7 +2611,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
2585 if (!rdev->ops->change_station) 2611 if (!rdev->ops->change_station)
2586 return -EOPNOTSUPP; 2612 return -EOPNOTSUPP;
2587 2613
2588 if (parse_station_flags(info, &params)) 2614 if (parse_station_flags(info, dev->ieee80211_ptr->iftype, &params))
2589 return -EINVAL; 2615 return -EINVAL;
2590 2616
2591 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) 2617 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION])
@@ -2731,7 +2757,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
2731 if (!rdev->ops->add_station) 2757 if (!rdev->ops->add_station)
2732 return -EOPNOTSUPP; 2758 return -EOPNOTSUPP;
2733 2759
2734 if (parse_station_flags(info, &params)) 2760 if (parse_station_flags(info, dev->ieee80211_ptr->iftype, &params))
2735 return -EINVAL; 2761 return -EINVAL;
2736 2762
2737 switch (dev->ieee80211_ptr->iftype) { 2763 switch (dev->ieee80211_ptr->iftype) {
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index e0d747a2e803..637f11a1e4df 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2927,7 +2927,7 @@ static int __net_init xfrm_user_net_init(struct net *net)
2927 if (nlsk == NULL) 2927 if (nlsk == NULL)
2928 return -ENOMEM; 2928 return -ENOMEM;
2929 net->xfrm.nlsk_stash = nlsk; /* Don't set to NULL */ 2929 net->xfrm.nlsk_stash = nlsk; /* Don't set to NULL */
2930 RCU_INIT_POINTER(net->xfrm.nlsk, nlsk); 2930 rcu_assign_pointer(net->xfrm.nlsk, nlsk);
2931 return 0; 2931 return 0;
2932} 2932}
2933 2933