diff options
author | David S. Miller <davem@davemloft.net> | 2015-12-17 22:08:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-17 22:08:28 -0500 |
commit | b3e0d3d7bab14f2544a3314bec53a23dc7dd2206 (patch) | |
tree | 2bd3c1c1d128e0c362655fa70a6eea02fc856f62 /net | |
parent | 3268e5cb494d8778a5a67a9fa2b1bdb0243b77ad (diff) | |
parent | 73796d8bf27372e26c2b79881947304c14c2d353 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts:
drivers/net/geneve.c
Here we had an overlapping change, where in 'net' the extraneous stats
bump was being removed whilst in 'net-next' the final argument to
udp_tunnel6_xmit_skb() was being changed.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
49 files changed, 371 insertions, 240 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index ae3a47f9d1d5..fbd0acf80b13 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -805,6 +805,9 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, | |||
805 | struct sock *sk; | 805 | struct sock *sk; |
806 | ax25_cb *ax25; | 806 | ax25_cb *ax25; |
807 | 807 | ||
808 | if (protocol < 0 || protocol > SK_PROTOCOL_MAX) | ||
809 | return -EINVAL; | ||
810 | |||
808 | if (!net_eq(net, &init_net)) | 811 | if (!net_eq(net, &init_net)) |
809 | return -EAFNOSUPPORT; | 812 | return -EAFNOSUPPORT; |
810 | 813 | ||
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 83bc1aaf5800..a49c705fb86b 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -566,6 +566,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) | |||
566 | int select; | 566 | int select; |
567 | batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; | 567 | batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; |
568 | struct batadv_dat_candidate *res; | 568 | struct batadv_dat_candidate *res; |
569 | struct batadv_dat_entry dat; | ||
569 | 570 | ||
570 | if (!bat_priv->orig_hash) | 571 | if (!bat_priv->orig_hash) |
571 | return NULL; | 572 | return NULL; |
@@ -575,7 +576,9 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) | |||
575 | if (!res) | 576 | if (!res) |
576 | return NULL; | 577 | return NULL; |
577 | 578 | ||
578 | ip_key = (batadv_dat_addr_t)batadv_hash_dat(&ip_dst, | 579 | dat.ip = ip_dst; |
580 | dat.vid = 0; | ||
581 | ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat, | ||
579 | BATADV_DAT_ADDR_MAX); | 582 | BATADV_DAT_ADDR_MAX); |
580 | 583 | ||
581 | batadv_dbg(BATADV_DBG_DAT, bat_priv, | 584 | batadv_dbg(BATADV_DBG_DAT, bat_priv, |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index a43f02e2d423..e4f2646d9246 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -836,6 +836,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, | |||
836 | u8 *orig_addr; | 836 | u8 *orig_addr; |
837 | struct batadv_orig_node *orig_node = NULL; | 837 | struct batadv_orig_node *orig_node = NULL; |
838 | int check, hdr_size = sizeof(*unicast_packet); | 838 | int check, hdr_size = sizeof(*unicast_packet); |
839 | enum batadv_subtype subtype; | ||
839 | bool is4addr; | 840 | bool is4addr; |
840 | 841 | ||
841 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 842 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
@@ -863,10 +864,20 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, | |||
863 | /* packet for me */ | 864 | /* packet for me */ |
864 | if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { | 865 | if (batadv_is_my_mac(bat_priv, unicast_packet->dest)) { |
865 | if (is4addr) { | 866 | if (is4addr) { |
866 | batadv_dat_inc_counter(bat_priv, | 867 | subtype = unicast_4addr_packet->subtype; |
867 | unicast_4addr_packet->subtype); | 868 | batadv_dat_inc_counter(bat_priv, subtype); |
868 | orig_addr = unicast_4addr_packet->src; | 869 | |
869 | orig_node = batadv_orig_hash_find(bat_priv, orig_addr); | 870 | /* Only payload data should be considered for speedy |
871 | * join. For example, DAT also uses unicast 4addr | ||
872 | * types, but those packets should not be considered | ||
873 | * for speedy join, since the clients do not actually | ||
874 | * reside at the sending originator. | ||
875 | */ | ||
876 | if (subtype == BATADV_P_DATA) { | ||
877 | orig_addr = unicast_4addr_packet->src; | ||
878 | orig_node = batadv_orig_hash_find(bat_priv, | ||
879 | orig_addr); | ||
880 | } | ||
870 | } | 881 | } |
871 | 882 | ||
872 | if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb, | 883 | if (batadv_dat_snoop_incoming_arp_request(bat_priv, skb, |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 5cf431177f34..ec67deff1621 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -68,13 +68,15 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv, | |||
68 | unsigned short vid, const char *message, | 68 | unsigned short vid, const char *message, |
69 | bool roaming); | 69 | bool roaming); |
70 | 70 | ||
71 | /* returns 1 if they are the same mac addr */ | 71 | /* returns 1 if they are the same mac addr and vid */ |
72 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) | 72 | static int batadv_compare_tt(const struct hlist_node *node, const void *data2) |
73 | { | 73 | { |
74 | const void *data1 = container_of(node, struct batadv_tt_common_entry, | 74 | const void *data1 = container_of(node, struct batadv_tt_common_entry, |
75 | hash_entry); | 75 | hash_entry); |
76 | const struct batadv_tt_common_entry *tt1 = data1; | ||
77 | const struct batadv_tt_common_entry *tt2 = data2; | ||
76 | 78 | ||
77 | return batadv_compare_eth(data1, data2); | 79 | return (tt1->vid == tt2->vid) && batadv_compare_eth(data1, data2); |
78 | } | 80 | } |
79 | 81 | ||
80 | /** | 82 | /** |
@@ -1427,9 +1429,15 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv, | |||
1427 | } | 1429 | } |
1428 | 1430 | ||
1429 | /* if the client was temporary added before receiving the first | 1431 | /* if the client was temporary added before receiving the first |
1430 | * OGM announcing it, we have to clear the TEMP flag | 1432 | * OGM announcing it, we have to clear the TEMP flag. Also, |
1433 | * remove the previous temporary orig node and re-add it | ||
1434 | * if required. If the orig entry changed, the new one which | ||
1435 | * is a non-temporary entry is preferred. | ||
1431 | */ | 1436 | */ |
1432 | common->flags &= ~BATADV_TT_CLIENT_TEMP; | 1437 | if (common->flags & BATADV_TT_CLIENT_TEMP) { |
1438 | batadv_tt_global_del_orig_list(tt_global_entry); | ||
1439 | common->flags &= ~BATADV_TT_CLIENT_TEMP; | ||
1440 | } | ||
1433 | 1441 | ||
1434 | /* the change can carry possible "attribute" flags like the | 1442 | /* the change can carry possible "attribute" flags like the |
1435 | * TT_CLIENT_WIFI, therefore they have to be copied in the | 1443 | * TT_CLIENT_WIFI, therefore they have to be copied in the |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index fe129663bd3f..f52bcbf2e58c 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -526,6 +526,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, | |||
526 | if (!addr || addr->sa_family != AF_BLUETOOTH) | 526 | if (!addr || addr->sa_family != AF_BLUETOOTH) |
527 | return -EINVAL; | 527 | return -EINVAL; |
528 | 528 | ||
529 | if (addr_len < sizeof(struct sockaddr_sco)) | ||
530 | return -EINVAL; | ||
531 | |||
529 | lock_sock(sk); | 532 | lock_sock(sk); |
530 | 533 | ||
531 | if (sk->sk_state != BT_OPEN) { | 534 | if (sk->sk_state != BT_OPEN) { |
diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c index 04257a0e3534..0260c84ed83c 100644 --- a/net/core/netclassid_cgroup.c +++ b/net/core/netclassid_cgroup.c | |||
@@ -84,9 +84,11 @@ static void update_classid(struct cgroup_subsys_state *css, void *v) | |||
84 | css_task_iter_end(&it); | 84 | css_task_iter_end(&it); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void cgrp_attach(struct cgroup_subsys_state *css, | 87 | static void cgrp_attach(struct cgroup_taskset *tset) |
88 | struct cgroup_taskset *tset) | ||
89 | { | 88 | { |
89 | struct cgroup_subsys_state *css; | ||
90 | |||
91 | cgroup_taskset_first(tset, &css); | ||
90 | update_classid(css, | 92 | update_classid(css, |
91 | (void *)(unsigned long)css_cls_state(css)->classid); | 93 | (void *)(unsigned long)css_cls_state(css)->classid); |
92 | } | 94 | } |
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 053d60c33395..f1efbc39ef6b 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -233,13 +233,14 @@ static int update_netprio(const void *v, struct file *file, unsigned n) | |||
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | 235 | ||
236 | static void net_prio_attach(struct cgroup_subsys_state *css, | 236 | static void net_prio_attach(struct cgroup_taskset *tset) |
237 | struct cgroup_taskset *tset) | ||
238 | { | 237 | { |
239 | struct task_struct *p; | 238 | struct task_struct *p; |
240 | void *v = (void *)(unsigned long)css->cgroup->id; | 239 | struct cgroup_subsys_state *css; |
240 | |||
241 | cgroup_taskset_for_each(p, css, tset) { | ||
242 | void *v = (void *)(unsigned long)css->cgroup->id; | ||
241 | 243 | ||
242 | cgroup_taskset_for_each(p, tset) { | ||
243 | task_lock(p); | 244 | task_lock(p); |
244 | iterate_fd(p->files, 0, update_netprio, v); | 245 | iterate_fd(p->files, 0, update_netprio, v); |
245 | task_unlock(p); | 246 | task_unlock(p); |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 152b9c70e252..b2df375ec9c2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -3643,7 +3643,8 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb, | |||
3643 | serr->ee.ee_info = tstype; | 3643 | serr->ee.ee_info = tstype; |
3644 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { | 3644 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { |
3645 | serr->ee.ee_data = skb_shinfo(skb)->tskey; | 3645 | serr->ee.ee_data = skb_shinfo(skb)->tskey; |
3646 | if (sk->sk_protocol == IPPROTO_TCP) | 3646 | if (sk->sk_protocol == IPPROTO_TCP && |
3647 | sk->sk_type == SOCK_STREAM) | ||
3647 | serr->ee.ee_data -= sk->sk_tskey; | 3648 | serr->ee.ee_data -= sk->sk_tskey; |
3648 | } | 3649 | } |
3649 | 3650 | ||
@@ -4268,7 +4269,7 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb) | |||
4268 | return NULL; | 4269 | return NULL; |
4269 | } | 4270 | } |
4270 | 4271 | ||
4271 | memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len, | 4272 | memmove(skb->data - ETH_HLEN, skb->data - skb->mac_len - VLAN_HLEN, |
4272 | 2 * ETH_ALEN); | 4273 | 2 * ETH_ALEN); |
4273 | skb->mac_header += VLAN_HLEN; | 4274 | skb->mac_header += VLAN_HLEN; |
4274 | return skb; | 4275 | return skb; |
diff --git a/net/core/sock.c b/net/core/sock.c index 1278d7b7bd9a..565bab7baca9 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -433,8 +433,6 @@ static bool sock_needs_netstamp(const struct sock *sk) | |||
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | #define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE)) | ||
437 | |||
438 | static void sock_disable_timestamp(struct sock *sk, unsigned long flags) | 436 | static void sock_disable_timestamp(struct sock *sk, unsigned long flags) |
439 | { | 437 | { |
440 | if (sk->sk_flags & flags) { | 438 | if (sk->sk_flags & flags) { |
@@ -874,7 +872,8 @@ set_rcvbuf: | |||
874 | 872 | ||
875 | if (val & SOF_TIMESTAMPING_OPT_ID && | 873 | if (val & SOF_TIMESTAMPING_OPT_ID && |
876 | !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) { | 874 | !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) { |
877 | if (sk->sk_protocol == IPPROTO_TCP) { | 875 | if (sk->sk_protocol == IPPROTO_TCP && |
876 | sk->sk_type == SOCK_STREAM) { | ||
878 | if (sk->sk_state != TCP_ESTABLISHED) { | 877 | if (sk->sk_state != TCP_ESTABLISHED) { |
879 | ret = -EINVAL; | 878 | ret = -EINVAL; |
880 | break; | 879 | break; |
@@ -1543,7 +1542,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | |||
1543 | */ | 1542 | */ |
1544 | is_charged = sk_filter_charge(newsk, filter); | 1543 | is_charged = sk_filter_charge(newsk, filter); |
1545 | 1544 | ||
1546 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk))) { | 1545 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { |
1547 | /* It is still raw copy of parent, so invalidate | 1546 | /* It is still raw copy of parent, so invalidate |
1548 | * destructor and make plain sk_free() */ | 1547 | * destructor and make plain sk_free() */ |
1549 | newsk->sk_destruct = NULL; | 1548 | newsk->sk_destruct = NULL; |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index eebf5ac8ce18..13d6b1a6e0fc 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -678,6 +678,9 @@ static int dn_create(struct net *net, struct socket *sock, int protocol, | |||
678 | { | 678 | { |
679 | struct sock *sk; | 679 | struct sock *sk; |
680 | 680 | ||
681 | if (protocol < 0 || protocol > SK_PROTOCOL_MAX) | ||
682 | return -EINVAL; | ||
683 | |||
681 | if (!net_eq(net, &init_net)) | 684 | if (!net_eq(net, &init_net)) |
682 | return -EAFNOSUPPORT; | 685 | return -EAFNOSUPPORT; |
683 | 686 | ||
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 11c4ca13ec3b..5c5db6636704 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -257,6 +257,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, | |||
257 | int try_loading_module = 0; | 257 | int try_loading_module = 0; |
258 | int err; | 258 | int err; |
259 | 259 | ||
260 | if (protocol < 0 || protocol >= IPPROTO_MAX) | ||
261 | return -EINVAL; | ||
262 | |||
260 | sock->state = SS_UNCONNECTED; | 263 | sock->state = SS_UNCONNECTED; |
261 | 264 | ||
262 | /* Look for the requested type/protocol pair. */ | 265 | /* Look for the requested type/protocol pair. */ |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index cc8f3e506cde..473447593060 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -1155,6 +1155,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1155 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1155 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
1156 | { | 1156 | { |
1157 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | 1157 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1158 | struct netdev_notifier_changeupper_info *info; | ||
1158 | struct in_device *in_dev; | 1159 | struct in_device *in_dev; |
1159 | struct net *net = dev_net(dev); | 1160 | struct net *net = dev_net(dev); |
1160 | unsigned int flags; | 1161 | unsigned int flags; |
@@ -1193,6 +1194,14 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo | |||
1193 | case NETDEV_CHANGEMTU: | 1194 | case NETDEV_CHANGEMTU: |
1194 | rt_cache_flush(net); | 1195 | rt_cache_flush(net); |
1195 | break; | 1196 | break; |
1197 | case NETDEV_CHANGEUPPER: | ||
1198 | info = ptr; | ||
1199 | /* flush all routes if dev is linked to or unlinked from | ||
1200 | * an L3 master device (e.g., VRF) | ||
1201 | */ | ||
1202 | if (info->upper_dev && netif_is_l3_master(info->upper_dev)) | ||
1203 | fib_disable_ip(dev, NETDEV_DOWN, true); | ||
1204 | break; | ||
1196 | } | 1205 | } |
1197 | return NOTIFY_DONE; | 1206 | return NOTIFY_DONE; |
1198 | } | 1207 | } |
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index e0fcbbbcfe54..bd903fe0f750 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -24,6 +24,7 @@ struct fou { | |||
24 | u16 type; | 24 | u16 type; |
25 | struct udp_offload udp_offloads; | 25 | struct udp_offload udp_offloads; |
26 | struct list_head list; | 26 | struct list_head list; |
27 | struct rcu_head rcu; | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | #define FOU_F_REMCSUM_NOPARTIAL BIT(0) | 30 | #define FOU_F_REMCSUM_NOPARTIAL BIT(0) |
@@ -417,7 +418,7 @@ static void fou_release(struct fou *fou) | |||
417 | list_del(&fou->list); | 418 | list_del(&fou->list); |
418 | udp_tunnel_sock_release(sock); | 419 | udp_tunnel_sock_release(sock); |
419 | 420 | ||
420 | kfree(fou); | 421 | kfree_rcu(fou, rcu); |
421 | } | 422 | } |
422 | 423 | ||
423 | static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg) | 424 | static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg) |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index a35584176535..c187c60e3e0c 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -60,6 +60,7 @@ config NFT_REJECT_IPV4 | |||
60 | 60 | ||
61 | config NFT_DUP_IPV4 | 61 | config NFT_DUP_IPV4 |
62 | tristate "IPv4 nf_tables packet duplication support" | 62 | tristate "IPv4 nf_tables packet duplication support" |
63 | depends on !NF_CONNTRACK || NF_CONNTRACK | ||
63 | select NF_DUP_IPV4 | 64 | select NF_DUP_IPV4 |
64 | help | 65 | help |
65 | This module enables IPv4 packet duplication support for nf_tables. | 66 | This module enables IPv4 packet duplication support for nf_tables. |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 7aa13bd3de29..205e6745393f 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1493,7 +1493,7 @@ bool tcp_prequeue(struct sock *sk, struct sk_buff *skb) | |||
1493 | if (likely(sk->sk_rx_dst)) | 1493 | if (likely(sk->sk_rx_dst)) |
1494 | skb_dst_drop(skb); | 1494 | skb_dst_drop(skb); |
1495 | else | 1495 | else |
1496 | skb_dst_force(skb); | 1496 | skb_dst_force_safe(skb); |
1497 | 1497 | ||
1498 | __skb_queue_tail(&tp->ucopy.prequeue, skb); | 1498 | __skb_queue_tail(&tp->ucopy.prequeue, skb); |
1499 | tp->ucopy.memory += skb->truesize; | 1499 | tp->ucopy.memory += skb->truesize; |
@@ -1721,8 +1721,7 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) | |||
1721 | { | 1721 | { |
1722 | struct dst_entry *dst = skb_dst(skb); | 1722 | struct dst_entry *dst = skb_dst(skb); |
1723 | 1723 | ||
1724 | if (dst) { | 1724 | if (dst && dst_hold_safe(dst)) { |
1725 | dst_hold(dst); | ||
1726 | sk->sk_rx_dst = dst; | 1725 | sk->sk_rx_dst = dst; |
1727 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; | 1726 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; |
1728 | } | 1727 | } |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a800cee88035..412a920fe0ec 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -3150,7 +3150,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) | |||
3150 | { | 3150 | { |
3151 | struct tcp_sock *tp = tcp_sk(sk); | 3151 | struct tcp_sock *tp = tcp_sk(sk); |
3152 | struct tcp_fastopen_request *fo = tp->fastopen_req; | 3152 | struct tcp_fastopen_request *fo = tp->fastopen_req; |
3153 | int syn_loss = 0, space, err = 0, copied; | 3153 | int syn_loss = 0, space, err = 0; |
3154 | unsigned long last_syn_loss = 0; | 3154 | unsigned long last_syn_loss = 0; |
3155 | struct sk_buff *syn_data; | 3155 | struct sk_buff *syn_data; |
3156 | 3156 | ||
@@ -3188,17 +3188,18 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) | |||
3188 | goto fallback; | 3188 | goto fallback; |
3189 | syn_data->ip_summed = CHECKSUM_PARTIAL; | 3189 | syn_data->ip_summed = CHECKSUM_PARTIAL; |
3190 | memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); | 3190 | memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); |
3191 | copied = copy_from_iter(skb_put(syn_data, space), space, | 3191 | if (space) { |
3192 | &fo->data->msg_iter); | 3192 | int copied = copy_from_iter(skb_put(syn_data, space), space, |
3193 | if (unlikely(!copied)) { | 3193 | &fo->data->msg_iter); |
3194 | kfree_skb(syn_data); | 3194 | if (unlikely(!copied)) { |
3195 | goto fallback; | 3195 | kfree_skb(syn_data); |
3196 | } | 3196 | goto fallback; |
3197 | if (copied != space) { | 3197 | } |
3198 | skb_trim(syn_data, copied); | 3198 | if (copied != space) { |
3199 | space = copied; | 3199 | skb_trim(syn_data, copied); |
3200 | space = copied; | ||
3201 | } | ||
3200 | } | 3202 | } |
3201 | |||
3202 | /* No more data pending in inet_wait_for_connect() */ | 3203 | /* No more data pending in inet_wait_for_connect() */ |
3203 | if (space == fo->size) | 3204 | if (space == fo->size) |
3204 | fo->data = NULL; | 3205 | fo->data = NULL; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 7082fb79d876..233efa67dc3d 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -350,6 +350,12 @@ static struct inet6_dev *ipv6_add_dev(struct net_device *dev) | |||
350 | setup_timer(&ndev->rs_timer, addrconf_rs_timer, | 350 | setup_timer(&ndev->rs_timer, addrconf_rs_timer, |
351 | (unsigned long)ndev); | 351 | (unsigned long)ndev); |
352 | memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); | 352 | memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); |
353 | |||
354 | if (ndev->cnf.stable_secret.initialized) | ||
355 | ndev->addr_gen_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY; | ||
356 | else | ||
357 | ndev->addr_gen_mode = IN6_ADDR_GEN_MODE_EUI64; | ||
358 | |||
353 | ndev->cnf.mtu6 = dev->mtu; | 359 | ndev->cnf.mtu6 = dev->mtu; |
354 | ndev->cnf.sysctl = NULL; | 360 | ndev->cnf.sysctl = NULL; |
355 | ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); | 361 | ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); |
@@ -2454,7 +2460,7 @@ ok: | |||
2454 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD | 2460 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD |
2455 | if (in6_dev->cnf.optimistic_dad && | 2461 | if (in6_dev->cnf.optimistic_dad && |
2456 | !net->ipv6.devconf_all->forwarding && sllao) | 2462 | !net->ipv6.devconf_all->forwarding && sllao) |
2457 | addr_flags = IFA_F_OPTIMISTIC; | 2463 | addr_flags |= IFA_F_OPTIMISTIC; |
2458 | #endif | 2464 | #endif |
2459 | 2465 | ||
2460 | /* Do not allow to create too much of autoconfigured | 2466 | /* Do not allow to create too much of autoconfigured |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 8ec0df75f1c4..9f5137cd604e 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -109,6 +109,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, | |||
109 | int try_loading_module = 0; | 109 | int try_loading_module = 0; |
110 | int err; | 110 | int err; |
111 | 111 | ||
112 | if (protocol < 0 || protocol >= IPPROTO_MAX) | ||
113 | return -EINVAL; | ||
114 | |||
112 | /* Look for the requested type/protocol pair. */ | 115 | /* Look for the requested type/protocol pair. */ |
113 | lookup_protocol: | 116 | lookup_protocol: |
114 | err = -ESOCKTNOSUPPORT; | 117 | err = -ESOCKTNOSUPPORT; |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 938d03ce5e4b..f37f18b6b40c 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1570,13 +1570,11 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], | |||
1570 | return -EEXIST; | 1570 | return -EEXIST; |
1571 | } else { | 1571 | } else { |
1572 | t = nt; | 1572 | t = nt; |
1573 | |||
1574 | ip6gre_tunnel_unlink(ign, t); | ||
1575 | ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); | ||
1576 | ip6gre_tunnel_link(ign, t); | ||
1577 | netdev_state_change(dev); | ||
1578 | } | 1573 | } |
1579 | 1574 | ||
1575 | ip6gre_tunnel_unlink(ign, t); | ||
1576 | ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); | ||
1577 | ip6gre_tunnel_link(ign, t); | ||
1580 | return 0; | 1578 | return 0; |
1581 | } | 1579 | } |
1582 | 1580 | ||
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index f6a024e141e5..e10a04c9cdc7 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
@@ -49,6 +49,7 @@ config NFT_REJECT_IPV6 | |||
49 | 49 | ||
50 | config NFT_DUP_IPV6 | 50 | config NFT_DUP_IPV6 |
51 | tristate "IPv6 nf_tables packet duplication support" | 51 | tristate "IPv6 nf_tables packet duplication support" |
52 | depends on !NF_CONNTRACK || NF_CONNTRACK | ||
52 | select NF_DUP_IPV6 | 53 | select NF_DUP_IPV6 |
53 | help | 54 | help |
54 | This module enables IPv6 packet duplication support for nf_tables. | 55 | This module enables IPv6 packet duplication support for nf_tables. |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 5382c2662fa2..f03d2b0445fd 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -93,10 +93,9 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb) | |||
93 | { | 93 | { |
94 | struct dst_entry *dst = skb_dst(skb); | 94 | struct dst_entry *dst = skb_dst(skb); |
95 | 95 | ||
96 | if (dst) { | 96 | if (dst && dst_hold_safe(dst)) { |
97 | const struct rt6_info *rt = (const struct rt6_info *)dst; | 97 | const struct rt6_info *rt = (const struct rt6_info *)dst; |
98 | 98 | ||
99 | dst_hold(dst); | ||
100 | sk->sk_rx_dst = dst; | 99 | sk->sk_rx_dst = dst; |
101 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; | 100 | inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; |
102 | inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); | 101 | inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index e6aa48b5395c..923abd6b3064 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1086,6 +1086,9 @@ static int irda_create(struct net *net, struct socket *sock, int protocol, | |||
1086 | struct sock *sk; | 1086 | struct sock *sk; |
1087 | struct irda_sock *self; | 1087 | struct irda_sock *self; |
1088 | 1088 | ||
1089 | if (protocol < 0 || protocol > SK_PROTOCOL_MAX) | ||
1090 | return -EINVAL; | ||
1091 | |||
1089 | if (net != &init_net) | 1092 | if (net != &init_net) |
1090 | return -EAFNOSUPPORT; | 1093 | return -EAFNOSUPPORT; |
1091 | 1094 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 2d1c4c35186d..166a29fe6c35 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1169,8 +1169,7 @@ static int sta_apply_parameters(struct ieee80211_local *local, | |||
1169 | * rc isn't initialized here yet, so ignore it | 1169 | * rc isn't initialized here yet, so ignore it |
1170 | */ | 1170 | */ |
1171 | __ieee80211_vht_handle_opmode(sdata, sta, | 1171 | __ieee80211_vht_handle_opmode(sdata, sta, |
1172 | params->opmode_notif, | 1172 | params->opmode_notif, band); |
1173 | band, false); | ||
1174 | } | 1173 | } |
1175 | 1174 | ||
1176 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 1175 | if (ieee80211_vif_is_mesh(&sdata->vif)) |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c30b6842ed9f..b84f6aa32c08 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1716,10 +1716,10 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); | |||
1716 | void ieee80211_sta_set_rx_nss(struct sta_info *sta); | 1716 | void ieee80211_sta_set_rx_nss(struct sta_info *sta); |
1717 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 1717 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
1718 | struct sta_info *sta, u8 opmode, | 1718 | struct sta_info *sta, u8 opmode, |
1719 | enum ieee80211_band band, bool nss_only); | 1719 | enum ieee80211_band band); |
1720 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 1720 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
1721 | struct sta_info *sta, u8 opmode, | 1721 | struct sta_info *sta, u8 opmode, |
1722 | enum ieee80211_band band, bool nss_only); | 1722 | enum ieee80211_band band); |
1723 | void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, | 1723 | void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, |
1724 | struct ieee80211_sta_vht_cap *vht_cap); | 1724 | struct ieee80211_sta_vht_cap *vht_cap); |
1725 | void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, | 1725 | void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 123b26d177e8..1c342e2592c4 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1379,21 +1379,26 @@ static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, | |||
1379 | */ | 1379 | */ |
1380 | if (has_80211h_pwr && | 1380 | if (has_80211h_pwr && |
1381 | (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) { | 1381 | (!has_cisco_pwr || pwr_level_80211h <= pwr_level_cisco)) { |
1382 | new_ap_level = pwr_level_80211h; | ||
1383 | |||
1384 | if (sdata->ap_power_level == new_ap_level) | ||
1385 | return 0; | ||
1386 | |||
1382 | sdata_dbg(sdata, | 1387 | sdata_dbg(sdata, |
1383 | "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", | 1388 | "Limiting TX power to %d (%d - %d) dBm as advertised by %pM\n", |
1384 | pwr_level_80211h, chan_pwr, pwr_reduction_80211h, | 1389 | pwr_level_80211h, chan_pwr, pwr_reduction_80211h, |
1385 | sdata->u.mgd.bssid); | 1390 | sdata->u.mgd.bssid); |
1386 | new_ap_level = pwr_level_80211h; | ||
1387 | } else { /* has_cisco_pwr is always true here. */ | 1391 | } else { /* has_cisco_pwr is always true here. */ |
1392 | new_ap_level = pwr_level_cisco; | ||
1393 | |||
1394 | if (sdata->ap_power_level == new_ap_level) | ||
1395 | return 0; | ||
1396 | |||
1388 | sdata_dbg(sdata, | 1397 | sdata_dbg(sdata, |
1389 | "Limiting TX power to %d dBm as advertised by %pM\n", | 1398 | "Limiting TX power to %d dBm as advertised by %pM\n", |
1390 | pwr_level_cisco, sdata->u.mgd.bssid); | 1399 | pwr_level_cisco, sdata->u.mgd.bssid); |
1391 | new_ap_level = pwr_level_cisco; | ||
1392 | } | 1400 | } |
1393 | 1401 | ||
1394 | if (sdata->ap_power_level == new_ap_level) | ||
1395 | return 0; | ||
1396 | |||
1397 | sdata->ap_power_level = new_ap_level; | 1402 | sdata->ap_power_level = new_ap_level; |
1398 | if (__ieee80211_recalc_txpower(sdata)) | 1403 | if (__ieee80211_recalc_txpower(sdata)) |
1399 | return BSS_CHANGED_TXPOWER; | 1404 | return BSS_CHANGED_TXPOWER; |
@@ -3577,7 +3582,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3577 | 3582 | ||
3578 | if (sta && elems.opmode_notif) | 3583 | if (sta && elems.opmode_notif) |
3579 | ieee80211_vht_handle_opmode(sdata, sta, *elems.opmode_notif, | 3584 | ieee80211_vht_handle_opmode(sdata, sta, *elems.opmode_notif, |
3580 | rx_status->band, true); | 3585 | rx_status->band); |
3581 | mutex_unlock(&local->sta_mtx); | 3586 | mutex_unlock(&local->sta_mtx); |
3582 | 3587 | ||
3583 | changed |= ieee80211_handle_pwr_constr(sdata, chan, mgmt, | 3588 | changed |= ieee80211_handle_pwr_constr(sdata, chan, mgmt, |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 1f827539d828..bc081850ac0e 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2735,8 +2735,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2735 | opmode = mgmt->u.action.u.vht_opmode_notif.operating_mode; | 2735 | opmode = mgmt->u.action.u.vht_opmode_notif.operating_mode; |
2736 | 2736 | ||
2737 | ieee80211_vht_handle_opmode(rx->sdata, rx->sta, | 2737 | ieee80211_vht_handle_opmode(rx->sdata, rx->sta, |
2738 | opmode, status->band, | 2738 | opmode, status->band); |
2739 | false); | ||
2740 | goto handled; | 2739 | goto handled; |
2741 | } | 2740 | } |
2742 | default: | 2741 | default: |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 08af2b307945..3943d4bf289c 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1644,6 +1644,29 @@ void ieee80211_stop_device(struct ieee80211_local *local) | |||
1644 | drv_stop(local); | 1644 | drv_stop(local); |
1645 | } | 1645 | } |
1646 | 1646 | ||
1647 | static void ieee80211_flush_completed_scan(struct ieee80211_local *local, | ||
1648 | bool aborted) | ||
1649 | { | ||
1650 | /* It's possible that we don't handle the scan completion in | ||
1651 | * time during suspend, so if it's still marked as completed | ||
1652 | * here, queue the work and flush it to clean things up. | ||
1653 | * Instead of calling the worker function directly here, we | ||
1654 | * really queue it to avoid potential races with other flows | ||
1655 | * scheduling the same work. | ||
1656 | */ | ||
1657 | if (test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
1658 | /* If coming from reconfiguration failure, abort the scan so | ||
1659 | * we don't attempt to continue a partial HW scan - which is | ||
1660 | * possible otherwise if (e.g.) the 2.4 GHz portion was the | ||
1661 | * completed scan, and a 5 GHz portion is still pending. | ||
1662 | */ | ||
1663 | if (aborted) | ||
1664 | set_bit(SCAN_ABORTED, &local->scanning); | ||
1665 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
1666 | flush_delayed_work(&local->scan_work); | ||
1667 | } | ||
1668 | } | ||
1669 | |||
1647 | static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) | 1670 | static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) |
1648 | { | 1671 | { |
1649 | struct ieee80211_sub_if_data *sdata; | 1672 | struct ieee80211_sub_if_data *sdata; |
@@ -1663,6 +1686,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) | |||
1663 | local->suspended = false; | 1686 | local->suspended = false; |
1664 | local->in_reconfig = false; | 1687 | local->in_reconfig = false; |
1665 | 1688 | ||
1689 | ieee80211_flush_completed_scan(local, true); | ||
1690 | |||
1666 | /* scheduled scan clearly can't be running any more, but tell | 1691 | /* scheduled scan clearly can't be running any more, but tell |
1667 | * cfg80211 and clear local state | 1692 | * cfg80211 and clear local state |
1668 | */ | 1693 | */ |
@@ -1701,6 +1726,27 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local, | |||
1701 | mutex_unlock(&local->chanctx_mtx); | 1726 | mutex_unlock(&local->chanctx_mtx); |
1702 | } | 1727 | } |
1703 | 1728 | ||
1729 | static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata) | ||
1730 | { | ||
1731 | struct ieee80211_local *local = sdata->local; | ||
1732 | struct sta_info *sta; | ||
1733 | |||
1734 | /* add STAs back */ | ||
1735 | mutex_lock(&local->sta_mtx); | ||
1736 | list_for_each_entry(sta, &local->sta_list, list) { | ||
1737 | enum ieee80211_sta_state state; | ||
1738 | |||
1739 | if (!sta->uploaded || sta->sdata != sdata) | ||
1740 | continue; | ||
1741 | |||
1742 | for (state = IEEE80211_STA_NOTEXIST; | ||
1743 | state < sta->sta_state; state++) | ||
1744 | WARN_ON(drv_sta_state(local, sta->sdata, sta, state, | ||
1745 | state + 1)); | ||
1746 | } | ||
1747 | mutex_unlock(&local->sta_mtx); | ||
1748 | } | ||
1749 | |||
1704 | int ieee80211_reconfig(struct ieee80211_local *local) | 1750 | int ieee80211_reconfig(struct ieee80211_local *local) |
1705 | { | 1751 | { |
1706 | struct ieee80211_hw *hw = &local->hw; | 1752 | struct ieee80211_hw *hw = &local->hw; |
@@ -1836,50 +1882,11 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1836 | WARN_ON(drv_add_chanctx(local, ctx)); | 1882 | WARN_ON(drv_add_chanctx(local, ctx)); |
1837 | mutex_unlock(&local->chanctx_mtx); | 1883 | mutex_unlock(&local->chanctx_mtx); |
1838 | 1884 | ||
1839 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1840 | if (!ieee80211_sdata_running(sdata)) | ||
1841 | continue; | ||
1842 | ieee80211_assign_chanctx(local, sdata); | ||
1843 | } | ||
1844 | |||
1845 | sdata = rtnl_dereference(local->monitor_sdata); | 1885 | sdata = rtnl_dereference(local->monitor_sdata); |
1846 | if (sdata && ieee80211_sdata_running(sdata)) | 1886 | if (sdata && ieee80211_sdata_running(sdata)) |
1847 | ieee80211_assign_chanctx(local, sdata); | 1887 | ieee80211_assign_chanctx(local, sdata); |
1848 | } | 1888 | } |
1849 | 1889 | ||
1850 | /* add STAs back */ | ||
1851 | mutex_lock(&local->sta_mtx); | ||
1852 | list_for_each_entry(sta, &local->sta_list, list) { | ||
1853 | enum ieee80211_sta_state state; | ||
1854 | |||
1855 | if (!sta->uploaded) | ||
1856 | continue; | ||
1857 | |||
1858 | /* AP-mode stations will be added later */ | ||
1859 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP) | ||
1860 | continue; | ||
1861 | |||
1862 | for (state = IEEE80211_STA_NOTEXIST; | ||
1863 | state < sta->sta_state; state++) | ||
1864 | WARN_ON(drv_sta_state(local, sta->sdata, sta, state, | ||
1865 | state + 1)); | ||
1866 | } | ||
1867 | mutex_unlock(&local->sta_mtx); | ||
1868 | |||
1869 | /* reconfigure tx conf */ | ||
1870 | if (hw->queues >= IEEE80211_NUM_ACS) { | ||
1871 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1872 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | ||
1873 | sdata->vif.type == NL80211_IFTYPE_MONITOR || | ||
1874 | !ieee80211_sdata_running(sdata)) | ||
1875 | continue; | ||
1876 | |||
1877 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
1878 | drv_conf_tx(local, sdata, i, | ||
1879 | &sdata->tx_conf[i]); | ||
1880 | } | ||
1881 | } | ||
1882 | |||
1883 | /* reconfigure hardware */ | 1890 | /* reconfigure hardware */ |
1884 | ieee80211_hw_config(local, ~0); | 1891 | ieee80211_hw_config(local, ~0); |
1885 | 1892 | ||
@@ -1892,6 +1899,22 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1892 | if (!ieee80211_sdata_running(sdata)) | 1899 | if (!ieee80211_sdata_running(sdata)) |
1893 | continue; | 1900 | continue; |
1894 | 1901 | ||
1902 | ieee80211_assign_chanctx(local, sdata); | ||
1903 | |||
1904 | switch (sdata->vif.type) { | ||
1905 | case NL80211_IFTYPE_AP_VLAN: | ||
1906 | case NL80211_IFTYPE_MONITOR: | ||
1907 | break; | ||
1908 | default: | ||
1909 | ieee80211_reconfig_stations(sdata); | ||
1910 | /* fall through */ | ||
1911 | case NL80211_IFTYPE_AP: /* AP stations are handled later */ | ||
1912 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
1913 | drv_conf_tx(local, sdata, i, | ||
1914 | &sdata->tx_conf[i]); | ||
1915 | break; | ||
1916 | } | ||
1917 | |||
1895 | /* common change flags for all interface types */ | 1918 | /* common change flags for all interface types */ |
1896 | changed = BSS_CHANGED_ERP_CTS_PROT | | 1919 | changed = BSS_CHANGED_ERP_CTS_PROT | |
1897 | BSS_CHANGED_ERP_PREAMBLE | | 1920 | BSS_CHANGED_ERP_PREAMBLE | |
@@ -2077,17 +2100,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
2077 | mb(); | 2100 | mb(); |
2078 | local->resuming = false; | 2101 | local->resuming = false; |
2079 | 2102 | ||
2080 | /* It's possible that we don't handle the scan completion in | 2103 | ieee80211_flush_completed_scan(local, false); |
2081 | * time during suspend, so if it's still marked as completed | ||
2082 | * here, queue the work and flush it to clean things up. | ||
2083 | * Instead of calling the worker function directly here, we | ||
2084 | * really queue it to avoid potential races with other flows | ||
2085 | * scheduling the same work. | ||
2086 | */ | ||
2087 | if (test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
2088 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
2089 | flush_delayed_work(&local->scan_work); | ||
2090 | } | ||
2091 | 2104 | ||
2092 | if (local->open_count && !reconfig_due_to_wowlan) | 2105 | if (local->open_count && !reconfig_due_to_wowlan) |
2093 | drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); | 2106 | drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); |
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c index ff1c798921a6..c38b2f07a919 100644 --- a/net/mac80211/vht.c +++ b/net/mac80211/vht.c | |||
@@ -378,7 +378,7 @@ void ieee80211_sta_set_rx_nss(struct sta_info *sta) | |||
378 | 378 | ||
379 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 379 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
380 | struct sta_info *sta, u8 opmode, | 380 | struct sta_info *sta, u8 opmode, |
381 | enum ieee80211_band band, bool nss_only) | 381 | enum ieee80211_band band) |
382 | { | 382 | { |
383 | struct ieee80211_local *local = sdata->local; | 383 | struct ieee80211_local *local = sdata->local; |
384 | struct ieee80211_supported_band *sband; | 384 | struct ieee80211_supported_band *sband; |
@@ -401,9 +401,6 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | |||
401 | changed |= IEEE80211_RC_NSS_CHANGED; | 401 | changed |= IEEE80211_RC_NSS_CHANGED; |
402 | } | 402 | } |
403 | 403 | ||
404 | if (nss_only) | ||
405 | return changed; | ||
406 | |||
407 | switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) { | 404 | switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) { |
408 | case IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: | 405 | case IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: |
409 | sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_20; | 406 | sta->cur_max_bandwidth = IEEE80211_STA_RX_BW_20; |
@@ -430,13 +427,12 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | |||
430 | 427 | ||
431 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 428 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
432 | struct sta_info *sta, u8 opmode, | 429 | struct sta_info *sta, u8 opmode, |
433 | enum ieee80211_band band, bool nss_only) | 430 | enum ieee80211_band band) |
434 | { | 431 | { |
435 | struct ieee80211_local *local = sdata->local; | 432 | struct ieee80211_local *local = sdata->local; |
436 | struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; | 433 | struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; |
437 | 434 | ||
438 | u32 changed = __ieee80211_vht_handle_opmode(sdata, sta, opmode, | 435 | u32 changed = __ieee80211_vht_handle_opmode(sdata, sta, opmode, band); |
439 | band, nss_only); | ||
440 | 436 | ||
441 | if (changed > 0) | 437 | if (changed > 0) |
442 | rate_control_rate_update(local, sband, sta, changed); | 438 | rate_control_rate_update(local, sband, sta, changed); |
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c index 4b3b9b310c3a..b18c5ed42d95 100644 --- a/net/mpls/af_mpls.c +++ b/net/mpls/af_mpls.c | |||
@@ -27,6 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | #define MAX_MP_SELECT_LABELS 4 | 28 | #define MAX_MP_SELECT_LABELS 4 |
29 | 29 | ||
30 | #define MPLS_NEIGH_TABLE_UNSPEC (NEIGH_LINK_TABLE + 1) | ||
31 | |||
30 | static int zero = 0; | 32 | static int zero = 0; |
31 | static int label_limit = (1 << 20) - 1; | 33 | static int label_limit = (1 << 20) - 1; |
32 | 34 | ||
@@ -341,7 +343,13 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev, | |||
341 | } | 343 | } |
342 | } | 344 | } |
343 | 345 | ||
344 | err = neigh_xmit(nh->nh_via_table, out_dev, mpls_nh_via(rt, nh), skb); | 346 | /* If via wasn't specified then send out using device address */ |
347 | if (nh->nh_via_table == MPLS_NEIGH_TABLE_UNSPEC) | ||
348 | err = neigh_xmit(NEIGH_LINK_TABLE, out_dev, | ||
349 | out_dev->dev_addr, skb); | ||
350 | else | ||
351 | err = neigh_xmit(nh->nh_via_table, out_dev, | ||
352 | mpls_nh_via(rt, nh), skb); | ||
345 | if (err) | 353 | if (err) |
346 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", | 354 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", |
347 | __func__, err); | 355 | __func__, err); |
@@ -559,6 +567,10 @@ static int mpls_nh_assign_dev(struct net *net, struct mpls_route *rt, | |||
559 | if (!mpls_dev_get(dev)) | 567 | if (!mpls_dev_get(dev)) |
560 | goto errout; | 568 | goto errout; |
561 | 569 | ||
570 | if ((nh->nh_via_table == NEIGH_LINK_TABLE) && | ||
571 | (dev->addr_len != nh->nh_via_alen)) | ||
572 | goto errout; | ||
573 | |||
562 | RCU_INIT_POINTER(nh->nh_dev, dev); | 574 | RCU_INIT_POINTER(nh->nh_dev, dev); |
563 | 575 | ||
564 | if (!(dev->flags & IFF_UP)) { | 576 | if (!(dev->flags & IFF_UP)) { |
@@ -630,10 +642,14 @@ static int mpls_nh_build(struct net *net, struct mpls_route *rt, | |||
630 | goto errout; | 642 | goto errout; |
631 | } | 643 | } |
632 | 644 | ||
633 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, | 645 | if (via) { |
634 | __mpls_nh_via(rt, nh)); | 646 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, |
635 | if (err) | 647 | __mpls_nh_via(rt, nh)); |
636 | goto errout; | 648 | if (err) |
649 | goto errout; | ||
650 | } else { | ||
651 | nh->nh_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
652 | } | ||
637 | 653 | ||
638 | err = mpls_nh_assign_dev(net, rt, nh, oif); | 654 | err = mpls_nh_assign_dev(net, rt, nh, oif); |
639 | if (err) | 655 | if (err) |
@@ -715,9 +731,6 @@ static int mpls_nh_build_multi(struct mpls_route_config *cfg, | |||
715 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); | 731 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); |
716 | } | 732 | } |
717 | 733 | ||
718 | if (!nla_via) | ||
719 | goto errout; | ||
720 | |||
721 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, | 734 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, |
722 | rtnh->rtnh_ifindex, nla_via, nla_newdst); | 735 | rtnh->rtnh_ifindex, nla_via, nla_newdst); |
723 | if (err) | 736 | if (err) |
@@ -1227,6 +1240,7 @@ static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1227 | 1240 | ||
1228 | cfg->rc_label = LABEL_NOT_SPECIFIED; | 1241 | cfg->rc_label = LABEL_NOT_SPECIFIED; |
1229 | cfg->rc_protocol = rtm->rtm_protocol; | 1242 | cfg->rc_protocol = rtm->rtm_protocol; |
1243 | cfg->rc_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
1230 | cfg->rc_nlflags = nlh->nlmsg_flags; | 1244 | cfg->rc_nlflags = nlh->nlmsg_flags; |
1231 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; | 1245 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; |
1232 | cfg->rc_nlinfo.nlh = nlh; | 1246 | cfg->rc_nlinfo.nlh = nlh; |
@@ -1340,7 +1354,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1340 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, | 1354 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, |
1341 | nh->nh_label)) | 1355 | nh->nh_label)) |
1342 | goto nla_put_failure; | 1356 | goto nla_put_failure; |
1343 | if (nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | 1357 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
1358 | nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | ||
1344 | nh->nh_via_alen)) | 1359 | nh->nh_via_alen)) |
1345 | goto nla_put_failure; | 1360 | goto nla_put_failure; |
1346 | dev = rtnl_dereference(nh->nh_dev); | 1361 | dev = rtnl_dereference(nh->nh_dev); |
@@ -1381,7 +1396,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1381 | nh->nh_labels, | 1396 | nh->nh_labels, |
1382 | nh->nh_label)) | 1397 | nh->nh_label)) |
1383 | goto nla_put_failure; | 1398 | goto nla_put_failure; |
1384 | if (nla_put_via(skb, nh->nh_via_table, | 1399 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
1400 | nla_put_via(skb, nh->nh_via_table, | ||
1385 | mpls_nh_via(rt, nh), | 1401 | mpls_nh_via(rt, nh), |
1386 | nh->nh_via_alen)) | 1402 | nh->nh_via_alen)) |
1387 | goto nla_put_failure; | 1403 | goto nla_put_failure; |
@@ -1448,7 +1464,8 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) | |||
1448 | 1464 | ||
1449 | if (nh->nh_dev) | 1465 | if (nh->nh_dev) |
1450 | payload += nla_total_size(4); /* RTA_OIF */ | 1466 | payload += nla_total_size(4); /* RTA_OIF */ |
1451 | payload += nla_total_size(2 + nh->nh_via_alen); /* RTA_VIA */ | 1467 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) /* RTA_VIA */ |
1468 | payload += nla_total_size(2 + nh->nh_via_alen); | ||
1452 | if (nh->nh_labels) /* RTA_NEWDST */ | 1469 | if (nh->nh_labels) /* RTA_NEWDST */ |
1453 | payload += nla_total_size(nh->nh_labels * 4); | 1470 | payload += nla_total_size(nh->nh_labels * 4); |
1454 | } else { | 1471 | } else { |
@@ -1457,7 +1474,9 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) | |||
1457 | 1474 | ||
1458 | for_nexthops(rt) { | 1475 | for_nexthops(rt) { |
1459 | nhsize += nla_total_size(sizeof(struct rtnexthop)); | 1476 | nhsize += nla_total_size(sizeof(struct rtnexthop)); |
1460 | nhsize += nla_total_size(2 + nh->nh_via_alen); | 1477 | /* RTA_VIA */ |
1478 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) | ||
1479 | nhsize += nla_total_size(2 + nh->nh_via_alen); | ||
1461 | if (nh->nh_labels) | 1480 | if (nh->nh_labels) |
1462 | nhsize += nla_total_size(nh->nh_labels * 4); | 1481 | nhsize += nla_total_size(nh->nh_labels * 4); |
1463 | } endfor_nexthops(rt); | 1482 | } endfor_nexthops(rt); |
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c index cdd01e6416db..fb31aa87de81 100644 --- a/net/mpls/mpls_iptunnel.c +++ b/net/mpls/mpls_iptunnel.c | |||
@@ -54,10 +54,10 @@ static int mpls_output(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
54 | unsigned int ttl; | 54 | unsigned int ttl; |
55 | 55 | ||
56 | /* Obtain the ttl */ | 56 | /* Obtain the ttl */ |
57 | if (skb->protocol == htons(ETH_P_IP)) { | 57 | if (dst->ops->family == AF_INET) { |
58 | ttl = ip_hdr(skb)->ttl; | 58 | ttl = ip_hdr(skb)->ttl; |
59 | rt = (struct rtable *)dst; | 59 | rt = (struct rtable *)dst; |
60 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 60 | } else if (dst->ops->family == AF_INET6) { |
61 | ttl = ipv6_hdr(skb)->hop_limit; | 61 | ttl = ipv6_hdr(skb)->hop_limit; |
62 | rt6 = (struct rt6_info *)dst; | 62 | rt6 = (struct rt6_info *)dst; |
63 | } else { | 63 | } else { |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 93cc4737018f..2cb429d34c03 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -89,6 +89,7 @@ nf_tables_afinfo_lookup(struct net *net, int family, bool autoload) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | static void nft_ctx_init(struct nft_ctx *ctx, | 91 | static void nft_ctx_init(struct nft_ctx *ctx, |
92 | struct net *net, | ||
92 | const struct sk_buff *skb, | 93 | const struct sk_buff *skb, |
93 | const struct nlmsghdr *nlh, | 94 | const struct nlmsghdr *nlh, |
94 | struct nft_af_info *afi, | 95 | struct nft_af_info *afi, |
@@ -96,7 +97,7 @@ static void nft_ctx_init(struct nft_ctx *ctx, | |||
96 | struct nft_chain *chain, | 97 | struct nft_chain *chain, |
97 | const struct nlattr * const *nla) | 98 | const struct nlattr * const *nla) |
98 | { | 99 | { |
99 | ctx->net = sock_net(skb->sk); | 100 | ctx->net = net; |
100 | ctx->afi = afi; | 101 | ctx->afi = afi; |
101 | ctx->table = table; | 102 | ctx->table = table; |
102 | ctx->chain = chain; | 103 | ctx->chain = chain; |
@@ -672,15 +673,14 @@ err: | |||
672 | return ret; | 673 | return ret; |
673 | } | 674 | } |
674 | 675 | ||
675 | static int nf_tables_newtable(struct sock *nlsk, struct sk_buff *skb, | 676 | static int nf_tables_newtable(struct net *net, struct sock *nlsk, |
676 | const struct nlmsghdr *nlh, | 677 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
677 | const struct nlattr * const nla[]) | 678 | const struct nlattr * const nla[]) |
678 | { | 679 | { |
679 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 680 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
680 | const struct nlattr *name; | 681 | const struct nlattr *name; |
681 | struct nft_af_info *afi; | 682 | struct nft_af_info *afi; |
682 | struct nft_table *table; | 683 | struct nft_table *table; |
683 | struct net *net = sock_net(skb->sk); | ||
684 | int family = nfmsg->nfgen_family; | 684 | int family = nfmsg->nfgen_family; |
685 | u32 flags = 0; | 685 | u32 flags = 0; |
686 | struct nft_ctx ctx; | 686 | struct nft_ctx ctx; |
@@ -706,7 +706,7 @@ static int nf_tables_newtable(struct sock *nlsk, struct sk_buff *skb, | |||
706 | if (nlh->nlmsg_flags & NLM_F_REPLACE) | 706 | if (nlh->nlmsg_flags & NLM_F_REPLACE) |
707 | return -EOPNOTSUPP; | 707 | return -EOPNOTSUPP; |
708 | 708 | ||
709 | nft_ctx_init(&ctx, skb, nlh, afi, table, NULL, nla); | 709 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); |
710 | return nf_tables_updtable(&ctx); | 710 | return nf_tables_updtable(&ctx); |
711 | } | 711 | } |
712 | 712 | ||
@@ -730,7 +730,7 @@ static int nf_tables_newtable(struct sock *nlsk, struct sk_buff *skb, | |||
730 | INIT_LIST_HEAD(&table->sets); | 730 | INIT_LIST_HEAD(&table->sets); |
731 | table->flags = flags; | 731 | table->flags = flags; |
732 | 732 | ||
733 | nft_ctx_init(&ctx, skb, nlh, afi, table, NULL, nla); | 733 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); |
734 | err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE); | 734 | err = nft_trans_table_add(&ctx, NFT_MSG_NEWTABLE); |
735 | if (err < 0) | 735 | if (err < 0) |
736 | goto err3; | 736 | goto err3; |
@@ -810,18 +810,17 @@ out: | |||
810 | return err; | 810 | return err; |
811 | } | 811 | } |
812 | 812 | ||
813 | static int nf_tables_deltable(struct sock *nlsk, struct sk_buff *skb, | 813 | static int nf_tables_deltable(struct net *net, struct sock *nlsk, |
814 | const struct nlmsghdr *nlh, | 814 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
815 | const struct nlattr * const nla[]) | 815 | const struct nlattr * const nla[]) |
816 | { | 816 | { |
817 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 817 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
818 | struct nft_af_info *afi; | 818 | struct nft_af_info *afi; |
819 | struct nft_table *table; | 819 | struct nft_table *table; |
820 | struct net *net = sock_net(skb->sk); | ||
821 | int family = nfmsg->nfgen_family; | 820 | int family = nfmsg->nfgen_family; |
822 | struct nft_ctx ctx; | 821 | struct nft_ctx ctx; |
823 | 822 | ||
824 | nft_ctx_init(&ctx, skb, nlh, NULL, NULL, NULL, nla); | 823 | nft_ctx_init(&ctx, net, skb, nlh, NULL, NULL, NULL, nla); |
825 | if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) | 824 | if (family == AF_UNSPEC || nla[NFTA_TABLE_NAME] == NULL) |
826 | return nft_flush(&ctx, family); | 825 | return nft_flush(&ctx, family); |
827 | 826 | ||
@@ -1221,8 +1220,8 @@ static void nf_tables_chain_destroy(struct nft_chain *chain) | |||
1221 | } | 1220 | } |
1222 | } | 1221 | } |
1223 | 1222 | ||
1224 | static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | 1223 | static int nf_tables_newchain(struct net *net, struct sock *nlsk, |
1225 | const struct nlmsghdr *nlh, | 1224 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
1226 | const struct nlattr * const nla[]) | 1225 | const struct nlattr * const nla[]) |
1227 | { | 1226 | { |
1228 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 1227 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
@@ -1232,7 +1231,6 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
1232 | struct nft_chain *chain; | 1231 | struct nft_chain *chain; |
1233 | struct nft_base_chain *basechain = NULL; | 1232 | struct nft_base_chain *basechain = NULL; |
1234 | struct nlattr *ha[NFTA_HOOK_MAX + 1]; | 1233 | struct nlattr *ha[NFTA_HOOK_MAX + 1]; |
1235 | struct net *net = sock_net(skb->sk); | ||
1236 | int family = nfmsg->nfgen_family; | 1234 | int family = nfmsg->nfgen_family; |
1237 | struct net_device *dev = NULL; | 1235 | struct net_device *dev = NULL; |
1238 | u8 policy = NF_ACCEPT; | 1236 | u8 policy = NF_ACCEPT; |
@@ -1313,7 +1311,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
1313 | return PTR_ERR(stats); | 1311 | return PTR_ERR(stats); |
1314 | } | 1312 | } |
1315 | 1313 | ||
1316 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1314 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
1317 | trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN, | 1315 | trans = nft_trans_alloc(&ctx, NFT_MSG_NEWCHAIN, |
1318 | sizeof(struct nft_trans_chain)); | 1316 | sizeof(struct nft_trans_chain)); |
1319 | if (trans == NULL) { | 1317 | if (trans == NULL) { |
@@ -1461,7 +1459,7 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
1461 | if (err < 0) | 1459 | if (err < 0) |
1462 | goto err1; | 1460 | goto err1; |
1463 | 1461 | ||
1464 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1462 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
1465 | err = nft_trans_chain_add(&ctx, NFT_MSG_NEWCHAIN); | 1463 | err = nft_trans_chain_add(&ctx, NFT_MSG_NEWCHAIN); |
1466 | if (err < 0) | 1464 | if (err < 0) |
1467 | goto err2; | 1465 | goto err2; |
@@ -1476,15 +1474,14 @@ err1: | |||
1476 | return err; | 1474 | return err; |
1477 | } | 1475 | } |
1478 | 1476 | ||
1479 | static int nf_tables_delchain(struct sock *nlsk, struct sk_buff *skb, | 1477 | static int nf_tables_delchain(struct net *net, struct sock *nlsk, |
1480 | const struct nlmsghdr *nlh, | 1478 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
1481 | const struct nlattr * const nla[]) | 1479 | const struct nlattr * const nla[]) |
1482 | { | 1480 | { |
1483 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 1481 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
1484 | struct nft_af_info *afi; | 1482 | struct nft_af_info *afi; |
1485 | struct nft_table *table; | 1483 | struct nft_table *table; |
1486 | struct nft_chain *chain; | 1484 | struct nft_chain *chain; |
1487 | struct net *net = sock_net(skb->sk); | ||
1488 | int family = nfmsg->nfgen_family; | 1485 | int family = nfmsg->nfgen_family; |
1489 | struct nft_ctx ctx; | 1486 | struct nft_ctx ctx; |
1490 | 1487 | ||
@@ -1506,7 +1503,7 @@ static int nf_tables_delchain(struct sock *nlsk, struct sk_buff *skb, | |||
1506 | if (chain->use > 0) | 1503 | if (chain->use > 0) |
1507 | return -EBUSY; | 1504 | return -EBUSY; |
1508 | 1505 | ||
1509 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 1506 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
1510 | 1507 | ||
1511 | return nft_delchain(&ctx); | 1508 | return nft_delchain(&ctx); |
1512 | } | 1509 | } |
@@ -2010,13 +2007,12 @@ static void nf_tables_rule_destroy(const struct nft_ctx *ctx, | |||
2010 | 2007 | ||
2011 | static struct nft_expr_info *info; | 2008 | static struct nft_expr_info *info; |
2012 | 2009 | ||
2013 | static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | 2010 | static int nf_tables_newrule(struct net *net, struct sock *nlsk, |
2014 | const struct nlmsghdr *nlh, | 2011 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
2015 | const struct nlattr * const nla[]) | 2012 | const struct nlattr * const nla[]) |
2016 | { | 2013 | { |
2017 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2014 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
2018 | struct nft_af_info *afi; | 2015 | struct nft_af_info *afi; |
2019 | struct net *net = sock_net(skb->sk); | ||
2020 | struct nft_table *table; | 2016 | struct nft_table *table; |
2021 | struct nft_chain *chain; | 2017 | struct nft_chain *chain; |
2022 | struct nft_rule *rule, *old_rule = NULL; | 2018 | struct nft_rule *rule, *old_rule = NULL; |
@@ -2075,7 +2071,7 @@ static int nf_tables_newrule(struct sock *nlsk, struct sk_buff *skb, | |||
2075 | return PTR_ERR(old_rule); | 2071 | return PTR_ERR(old_rule); |
2076 | } | 2072 | } |
2077 | 2073 | ||
2078 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 2074 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
2079 | 2075 | ||
2080 | n = 0; | 2076 | n = 0; |
2081 | size = 0; | 2077 | size = 0; |
@@ -2176,13 +2172,12 @@ err1: | |||
2176 | return err; | 2172 | return err; |
2177 | } | 2173 | } |
2178 | 2174 | ||
2179 | static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, | 2175 | static int nf_tables_delrule(struct net *net, struct sock *nlsk, |
2180 | const struct nlmsghdr *nlh, | 2176 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
2181 | const struct nlattr * const nla[]) | 2177 | const struct nlattr * const nla[]) |
2182 | { | 2178 | { |
2183 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2179 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
2184 | struct nft_af_info *afi; | 2180 | struct nft_af_info *afi; |
2185 | struct net *net = sock_net(skb->sk); | ||
2186 | struct nft_table *table; | 2181 | struct nft_table *table; |
2187 | struct nft_chain *chain = NULL; | 2182 | struct nft_chain *chain = NULL; |
2188 | struct nft_rule *rule; | 2183 | struct nft_rule *rule; |
@@ -2205,7 +2200,7 @@ static int nf_tables_delrule(struct sock *nlsk, struct sk_buff *skb, | |||
2205 | return PTR_ERR(chain); | 2200 | return PTR_ERR(chain); |
2206 | } | 2201 | } |
2207 | 2202 | ||
2208 | nft_ctx_init(&ctx, skb, nlh, afi, table, chain, nla); | 2203 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, chain, nla); |
2209 | 2204 | ||
2210 | if (chain) { | 2205 | if (chain) { |
2211 | if (nla[NFTA_RULE_HANDLE]) { | 2206 | if (nla[NFTA_RULE_HANDLE]) { |
@@ -2344,12 +2339,11 @@ static const struct nla_policy nft_set_desc_policy[NFTA_SET_DESC_MAX + 1] = { | |||
2344 | [NFTA_SET_DESC_SIZE] = { .type = NLA_U32 }, | 2339 | [NFTA_SET_DESC_SIZE] = { .type = NLA_U32 }, |
2345 | }; | 2340 | }; |
2346 | 2341 | ||
2347 | static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, | 2342 | static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, struct net *net, |
2348 | const struct sk_buff *skb, | 2343 | const struct sk_buff *skb, |
2349 | const struct nlmsghdr *nlh, | 2344 | const struct nlmsghdr *nlh, |
2350 | const struct nlattr * const nla[]) | 2345 | const struct nlattr * const nla[]) |
2351 | { | 2346 | { |
2352 | struct net *net = sock_net(skb->sk); | ||
2353 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2347 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
2354 | struct nft_af_info *afi = NULL; | 2348 | struct nft_af_info *afi = NULL; |
2355 | struct nft_table *table = NULL; | 2349 | struct nft_table *table = NULL; |
@@ -2371,7 +2365,7 @@ static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, | |||
2371 | return -ENOENT; | 2365 | return -ENOENT; |
2372 | } | 2366 | } |
2373 | 2367 | ||
2374 | nft_ctx_init(ctx, skb, nlh, afi, table, NULL, nla); | 2368 | nft_ctx_init(ctx, net, skb, nlh, afi, table, NULL, nla); |
2375 | return 0; | 2369 | return 0; |
2376 | } | 2370 | } |
2377 | 2371 | ||
@@ -2623,6 +2617,7 @@ static int nf_tables_getset(struct sock *nlsk, struct sk_buff *skb, | |||
2623 | const struct nlmsghdr *nlh, | 2617 | const struct nlmsghdr *nlh, |
2624 | const struct nlattr * const nla[]) | 2618 | const struct nlattr * const nla[]) |
2625 | { | 2619 | { |
2620 | struct net *net = sock_net(skb->sk); | ||
2626 | const struct nft_set *set; | 2621 | const struct nft_set *set; |
2627 | struct nft_ctx ctx; | 2622 | struct nft_ctx ctx; |
2628 | struct sk_buff *skb2; | 2623 | struct sk_buff *skb2; |
@@ -2630,7 +2625,7 @@ static int nf_tables_getset(struct sock *nlsk, struct sk_buff *skb, | |||
2630 | int err; | 2625 | int err; |
2631 | 2626 | ||
2632 | /* Verify existence before starting dump */ | 2627 | /* Verify existence before starting dump */ |
2633 | err = nft_ctx_init_from_setattr(&ctx, skb, nlh, nla); | 2628 | err = nft_ctx_init_from_setattr(&ctx, net, skb, nlh, nla); |
2634 | if (err < 0) | 2629 | if (err < 0) |
2635 | return err; | 2630 | return err; |
2636 | 2631 | ||
@@ -2693,14 +2688,13 @@ static int nf_tables_set_desc_parse(const struct nft_ctx *ctx, | |||
2693 | return 0; | 2688 | return 0; |
2694 | } | 2689 | } |
2695 | 2690 | ||
2696 | static int nf_tables_newset(struct sock *nlsk, struct sk_buff *skb, | 2691 | static int nf_tables_newset(struct net *net, struct sock *nlsk, |
2697 | const struct nlmsghdr *nlh, | 2692 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
2698 | const struct nlattr * const nla[]) | 2693 | const struct nlattr * const nla[]) |
2699 | { | 2694 | { |
2700 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2695 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
2701 | const struct nft_set_ops *ops; | 2696 | const struct nft_set_ops *ops; |
2702 | struct nft_af_info *afi; | 2697 | struct nft_af_info *afi; |
2703 | struct net *net = sock_net(skb->sk); | ||
2704 | struct nft_table *table; | 2698 | struct nft_table *table; |
2705 | struct nft_set *set; | 2699 | struct nft_set *set; |
2706 | struct nft_ctx ctx; | 2700 | struct nft_ctx ctx; |
@@ -2798,7 +2792,7 @@ static int nf_tables_newset(struct sock *nlsk, struct sk_buff *skb, | |||
2798 | if (IS_ERR(table)) | 2792 | if (IS_ERR(table)) |
2799 | return PTR_ERR(table); | 2793 | return PTR_ERR(table); |
2800 | 2794 | ||
2801 | nft_ctx_init(&ctx, skb, nlh, afi, table, NULL, nla); | 2795 | nft_ctx_init(&ctx, net, skb, nlh, afi, table, NULL, nla); |
2802 | 2796 | ||
2803 | set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME]); | 2797 | set = nf_tables_set_lookup(table, nla[NFTA_SET_NAME]); |
2804 | if (IS_ERR(set)) { | 2798 | if (IS_ERR(set)) { |
@@ -2882,8 +2876,8 @@ static void nf_tables_set_destroy(const struct nft_ctx *ctx, struct nft_set *set | |||
2882 | nft_set_destroy(set); | 2876 | nft_set_destroy(set); |
2883 | } | 2877 | } |
2884 | 2878 | ||
2885 | static int nf_tables_delset(struct sock *nlsk, struct sk_buff *skb, | 2879 | static int nf_tables_delset(struct net *net, struct sock *nlsk, |
2886 | const struct nlmsghdr *nlh, | 2880 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
2887 | const struct nlattr * const nla[]) | 2881 | const struct nlattr * const nla[]) |
2888 | { | 2882 | { |
2889 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 2883 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
@@ -2896,7 +2890,7 @@ static int nf_tables_delset(struct sock *nlsk, struct sk_buff *skb, | |||
2896 | if (nla[NFTA_SET_TABLE] == NULL) | 2890 | if (nla[NFTA_SET_TABLE] == NULL) |
2897 | return -EINVAL; | 2891 | return -EINVAL; |
2898 | 2892 | ||
2899 | err = nft_ctx_init_from_setattr(&ctx, skb, nlh, nla); | 2893 | err = nft_ctx_init_from_setattr(&ctx, net, skb, nlh, nla); |
2900 | if (err < 0) | 2894 | if (err < 0) |
2901 | return err; | 2895 | return err; |
2902 | 2896 | ||
@@ -3024,7 +3018,7 @@ static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX + | |||
3024 | [NFTA_SET_ELEM_LIST_SET_ID] = { .type = NLA_U32 }, | 3018 | [NFTA_SET_ELEM_LIST_SET_ID] = { .type = NLA_U32 }, |
3025 | }; | 3019 | }; |
3026 | 3020 | ||
3027 | static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, | 3021 | static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, struct net *net, |
3028 | const struct sk_buff *skb, | 3022 | const struct sk_buff *skb, |
3029 | const struct nlmsghdr *nlh, | 3023 | const struct nlmsghdr *nlh, |
3030 | const struct nlattr * const nla[], | 3024 | const struct nlattr * const nla[], |
@@ -3033,7 +3027,6 @@ static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, | |||
3033 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); | 3027 | const struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
3034 | struct nft_af_info *afi; | 3028 | struct nft_af_info *afi; |
3035 | struct nft_table *table; | 3029 | struct nft_table *table; |
3036 | struct net *net = sock_net(skb->sk); | ||
3037 | 3030 | ||
3038 | afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); | 3031 | afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); |
3039 | if (IS_ERR(afi)) | 3032 | if (IS_ERR(afi)) |
@@ -3045,7 +3038,7 @@ static int nft_ctx_init_from_elemattr(struct nft_ctx *ctx, | |||
3045 | if (!trans && (table->flags & NFT_TABLE_INACTIVE)) | 3038 | if (!trans && (table->flags & NFT_TABLE_INACTIVE)) |
3046 | return -ENOENT; | 3039 | return -ENOENT; |
3047 | 3040 | ||
3048 | nft_ctx_init(ctx, skb, nlh, afi, table, NULL, nla); | 3041 | nft_ctx_init(ctx, net, skb, nlh, afi, table, NULL, nla); |
3049 | return 0; | 3042 | return 0; |
3050 | } | 3043 | } |
3051 | 3044 | ||
@@ -3135,6 +3128,7 @@ static int nf_tables_dump_setelem(const struct nft_ctx *ctx, | |||
3135 | 3128 | ||
3136 | static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) | 3129 | static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) |
3137 | { | 3130 | { |
3131 | struct net *net = sock_net(skb->sk); | ||
3138 | const struct nft_set *set; | 3132 | const struct nft_set *set; |
3139 | struct nft_set_dump_args args; | 3133 | struct nft_set_dump_args args; |
3140 | struct nft_ctx ctx; | 3134 | struct nft_ctx ctx; |
@@ -3150,8 +3144,8 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) | |||
3150 | if (err < 0) | 3144 | if (err < 0) |
3151 | return err; | 3145 | return err; |
3152 | 3146 | ||
3153 | err = nft_ctx_init_from_elemattr(&ctx, cb->skb, cb->nlh, (void *)nla, | 3147 | err = nft_ctx_init_from_elemattr(&ctx, net, cb->skb, cb->nlh, |
3154 | false); | 3148 | (void *)nla, false); |
3155 | if (err < 0) | 3149 | if (err < 0) |
3156 | return err; | 3150 | return err; |
3157 | 3151 | ||
@@ -3212,11 +3206,12 @@ static int nf_tables_getsetelem(struct sock *nlsk, struct sk_buff *skb, | |||
3212 | const struct nlmsghdr *nlh, | 3206 | const struct nlmsghdr *nlh, |
3213 | const struct nlattr * const nla[]) | 3207 | const struct nlattr * const nla[]) |
3214 | { | 3208 | { |
3209 | struct net *net = sock_net(skb->sk); | ||
3215 | const struct nft_set *set; | 3210 | const struct nft_set *set; |
3216 | struct nft_ctx ctx; | 3211 | struct nft_ctx ctx; |
3217 | int err; | 3212 | int err; |
3218 | 3213 | ||
3219 | err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, false); | 3214 | err = nft_ctx_init_from_elemattr(&ctx, net, skb, nlh, nla, false); |
3220 | if (err < 0) | 3215 | if (err < 0) |
3221 | return err; | 3216 | return err; |
3222 | 3217 | ||
@@ -3528,11 +3523,10 @@ err1: | |||
3528 | return err; | 3523 | return err; |
3529 | } | 3524 | } |
3530 | 3525 | ||
3531 | static int nf_tables_newsetelem(struct sock *nlsk, struct sk_buff *skb, | 3526 | static int nf_tables_newsetelem(struct net *net, struct sock *nlsk, |
3532 | const struct nlmsghdr *nlh, | 3527 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
3533 | const struct nlattr * const nla[]) | 3528 | const struct nlattr * const nla[]) |
3534 | { | 3529 | { |
3535 | struct net *net = sock_net(skb->sk); | ||
3536 | const struct nlattr *attr; | 3530 | const struct nlattr *attr; |
3537 | struct nft_set *set; | 3531 | struct nft_set *set; |
3538 | struct nft_ctx ctx; | 3532 | struct nft_ctx ctx; |
@@ -3541,7 +3535,7 @@ static int nf_tables_newsetelem(struct sock *nlsk, struct sk_buff *skb, | |||
3541 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) | 3535 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) |
3542 | return -EINVAL; | 3536 | return -EINVAL; |
3543 | 3537 | ||
3544 | err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, true); | 3538 | err = nft_ctx_init_from_elemattr(&ctx, net, skb, nlh, nla, true); |
3545 | if (err < 0) | 3539 | if (err < 0) |
3546 | return err; | 3540 | return err; |
3547 | 3541 | ||
@@ -3623,8 +3617,8 @@ err1: | |||
3623 | return err; | 3617 | return err; |
3624 | } | 3618 | } |
3625 | 3619 | ||
3626 | static int nf_tables_delsetelem(struct sock *nlsk, struct sk_buff *skb, | 3620 | static int nf_tables_delsetelem(struct net *net, struct sock *nlsk, |
3627 | const struct nlmsghdr *nlh, | 3621 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
3628 | const struct nlattr * const nla[]) | 3622 | const struct nlattr * const nla[]) |
3629 | { | 3623 | { |
3630 | const struct nlattr *attr; | 3624 | const struct nlattr *attr; |
@@ -3635,7 +3629,7 @@ static int nf_tables_delsetelem(struct sock *nlsk, struct sk_buff *skb, | |||
3635 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) | 3629 | if (nla[NFTA_SET_ELEM_LIST_ELEMENTS] == NULL) |
3636 | return -EINVAL; | 3630 | return -EINVAL; |
3637 | 3631 | ||
3638 | err = nft_ctx_init_from_elemattr(&ctx, skb, nlh, nla, false); | 3632 | err = nft_ctx_init_from_elemattr(&ctx, net, skb, nlh, nla, false); |
3639 | if (err < 0) | 3633 | if (err < 0) |
3640 | return err; | 3634 | return err; |
3641 | 3635 | ||
@@ -4030,7 +4024,8 @@ static int nf_tables_abort(struct sk_buff *skb) | |||
4030 | struct nft_trans *trans, *next; | 4024 | struct nft_trans *trans, *next; |
4031 | struct nft_trans_elem *te; | 4025 | struct nft_trans_elem *te; |
4032 | 4026 | ||
4033 | list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { | 4027 | list_for_each_entry_safe_reverse(trans, next, &net->nft.commit_list, |
4028 | list) { | ||
4034 | switch (trans->msg_type) { | 4029 | switch (trans->msg_type) { |
4035 | case NFT_MSG_NEWTABLE: | 4030 | case NFT_MSG_NEWTABLE: |
4036 | if (nft_trans_table_update(trans)) { | 4031 | if (nft_trans_table_update(trans)) { |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 46453ab318db..77afe913d03d 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -295,8 +295,6 @@ replay: | |||
295 | if (!skb) | 295 | if (!skb) |
296 | return netlink_ack(oskb, nlh, -ENOMEM); | 296 | return netlink_ack(oskb, nlh, -ENOMEM); |
297 | 297 | ||
298 | skb->sk = oskb->sk; | ||
299 | |||
300 | nfnl_lock(subsys_id); | 298 | nfnl_lock(subsys_id); |
301 | ss = rcu_dereference_protected(table[subsys_id].subsys, | 299 | ss = rcu_dereference_protected(table[subsys_id].subsys, |
302 | lockdep_is_held(&table[subsys_id].mutex)); | 300 | lockdep_is_held(&table[subsys_id].mutex)); |
@@ -381,7 +379,7 @@ replay: | |||
381 | goto ack; | 379 | goto ack; |
382 | 380 | ||
383 | if (nc->call_batch) { | 381 | if (nc->call_batch) { |
384 | err = nc->call_batch(net->nfnl, skb, nlh, | 382 | err = nc->call_batch(net, net->nfnl, skb, nlh, |
385 | (const struct nlattr **)cda); | 383 | (const struct nlattr **)cda); |
386 | } | 384 | } |
387 | 385 | ||
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 7d81d280cb4f..861c6615253b 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -365,8 +365,9 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, | |||
365 | break; | 365 | break; |
366 | } | 366 | } |
367 | 367 | ||
368 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
369 | |||
368 | if (queue->flags & NFQA_CFG_F_CONNTRACK) { | 370 | if (queue->flags & NFQA_CFG_F_CONNTRACK) { |
369 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
370 | if (nfnl_ct != NULL) { | 371 | if (nfnl_ct != NULL) { |
371 | ct = nfnl_ct->get_ct(entskb, &ctinfo); | 372 | ct = nfnl_ct->get_ct(entskb, &ctinfo); |
372 | if (ct != NULL) | 373 | if (ct != NULL) |
@@ -1064,9 +1065,10 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb, | |||
1064 | if (entry == NULL) | 1065 | if (entry == NULL) |
1065 | return -ENOENT; | 1066 | return -ENOENT; |
1066 | 1067 | ||
1068 | /* rcu lock already held from nfnl->call_rcu. */ | ||
1069 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
1070 | |||
1067 | if (nfqa[NFQA_CT]) { | 1071 | if (nfqa[NFQA_CT]) { |
1068 | /* rcu lock already held from nfnl->call_rcu. */ | ||
1069 | nfnl_ct = rcu_dereference(nfnl_ct_hook); | ||
1070 | if (nfnl_ct != NULL) | 1072 | if (nfnl_ct != NULL) |
1071 | ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo); | 1073 | ct = nfqnl_ct_parse(nfnl_ct, nlh, nfqa, entry, &ctinfo); |
1072 | } | 1074 | } |
@@ -1417,6 +1419,7 @@ static int __init nfnetlink_queue_init(void) | |||
1417 | 1419 | ||
1418 | cleanup_netlink_notifier: | 1420 | cleanup_netlink_notifier: |
1419 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1421 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
1422 | unregister_pernet_subsys(&nfnl_queue_net_ops); | ||
1420 | out: | 1423 | out: |
1421 | return status; | 1424 | return status; |
1422 | } | 1425 | } |
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index c2cc11168fd5..3e8892216f94 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -53,6 +53,8 @@ struct ovs_conntrack_info { | |||
53 | struct md_labels labels; | 53 | struct md_labels labels; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info); | ||
57 | |||
56 | static u16 key_to_nfproto(const struct sw_flow_key *key) | 58 | static u16 key_to_nfproto(const struct sw_flow_key *key) |
57 | { | 59 | { |
58 | switch (ntohs(key->eth.type)) { | 60 | switch (ntohs(key->eth.type)) { |
@@ -141,6 +143,7 @@ static void __ovs_ct_update_key(struct sw_flow_key *key, u8 state, | |||
141 | * previously sent the packet to conntrack via the ct action. | 143 | * previously sent the packet to conntrack via the ct action. |
142 | */ | 144 | */ |
143 | static void ovs_ct_update_key(const struct sk_buff *skb, | 145 | static void ovs_ct_update_key(const struct sk_buff *skb, |
146 | const struct ovs_conntrack_info *info, | ||
144 | struct sw_flow_key *key, bool post_ct) | 147 | struct sw_flow_key *key, bool post_ct) |
145 | { | 148 | { |
146 | const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt; | 149 | const struct nf_conntrack_zone *zone = &nf_ct_zone_dflt; |
@@ -158,13 +161,15 @@ static void ovs_ct_update_key(const struct sk_buff *skb, | |||
158 | zone = nf_ct_zone(ct); | 161 | zone = nf_ct_zone(ct); |
159 | } else if (post_ct) { | 162 | } else if (post_ct) { |
160 | state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID; | 163 | state = OVS_CS_F_TRACKED | OVS_CS_F_INVALID; |
164 | if (info) | ||
165 | zone = &info->zone; | ||
161 | } | 166 | } |
162 | __ovs_ct_update_key(key, state, zone, ct); | 167 | __ovs_ct_update_key(key, state, zone, ct); |
163 | } | 168 | } |
164 | 169 | ||
165 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) | 170 | void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) |
166 | { | 171 | { |
167 | ovs_ct_update_key(skb, key, false); | 172 | ovs_ct_update_key(skb, NULL, key, false); |
168 | } | 173 | } |
169 | 174 | ||
170 | int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) | 175 | int ovs_ct_put_key(const struct sw_flow_key *key, struct sk_buff *skb) |
@@ -418,7 +423,7 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key, | |||
418 | } | 423 | } |
419 | } | 424 | } |
420 | 425 | ||
421 | ovs_ct_update_key(skb, key, true); | 426 | ovs_ct_update_key(skb, info, key, true); |
422 | 427 | ||
423 | return 0; | 428 | return 0; |
424 | } | 429 | } |
@@ -708,7 +713,7 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, | |||
708 | nf_conntrack_get(&ct_info.ct->ct_general); | 713 | nf_conntrack_get(&ct_info.ct->ct_general); |
709 | return 0; | 714 | return 0; |
710 | err_free_ct: | 715 | err_free_ct: |
711 | nf_conntrack_free(ct_info.ct); | 716 | __ovs_ct_free_action(&ct_info); |
712 | return err; | 717 | return err; |
713 | } | 718 | } |
714 | 719 | ||
@@ -750,6 +755,11 @@ void ovs_ct_free_action(const struct nlattr *a) | |||
750 | { | 755 | { |
751 | struct ovs_conntrack_info *ct_info = nla_data(a); | 756 | struct ovs_conntrack_info *ct_info = nla_data(a); |
752 | 757 | ||
758 | __ovs_ct_free_action(ct_info); | ||
759 | } | ||
760 | |||
761 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info) | ||
762 | { | ||
753 | if (ct_info->helper) | 763 | if (ct_info->helper) |
754 | module_put(ct_info->helper->me); | 764 | module_put(ct_info->helper->me); |
755 | if (ct_info->ct) | 765 | if (ct_info->ct) |
diff --git a/net/rfkill/core.c b/net/rfkill/core.c index b41e9ea2ffff..f53bf3b6558b 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c | |||
@@ -49,7 +49,6 @@ | |||
49 | struct rfkill { | 49 | struct rfkill { |
50 | spinlock_t lock; | 50 | spinlock_t lock; |
51 | 51 | ||
52 | const char *name; | ||
53 | enum rfkill_type type; | 52 | enum rfkill_type type; |
54 | 53 | ||
55 | unsigned long state; | 54 | unsigned long state; |
@@ -73,6 +72,7 @@ struct rfkill { | |||
73 | struct delayed_work poll_work; | 72 | struct delayed_work poll_work; |
74 | struct work_struct uevent_work; | 73 | struct work_struct uevent_work; |
75 | struct work_struct sync_work; | 74 | struct work_struct sync_work; |
75 | char name[]; | ||
76 | }; | 76 | }; |
77 | #define to_rfkill(d) container_of(d, struct rfkill, dev) | 77 | #define to_rfkill(d) container_of(d, struct rfkill, dev) |
78 | 78 | ||
@@ -876,14 +876,14 @@ struct rfkill * __must_check rfkill_alloc(const char *name, | |||
876 | if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES)) | 876 | if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES)) |
877 | return NULL; | 877 | return NULL; |
878 | 878 | ||
879 | rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL); | 879 | rfkill = kzalloc(sizeof(*rfkill) + strlen(name) + 1, GFP_KERNEL); |
880 | if (!rfkill) | 880 | if (!rfkill) |
881 | return NULL; | 881 | return NULL; |
882 | 882 | ||
883 | spin_lock_init(&rfkill->lock); | 883 | spin_lock_init(&rfkill->lock); |
884 | INIT_LIST_HEAD(&rfkill->node); | 884 | INIT_LIST_HEAD(&rfkill->node); |
885 | rfkill->type = type; | 885 | rfkill->type = type; |
886 | rfkill->name = name; | 886 | strcpy(rfkill->name, name); |
887 | rfkill->ops = ops; | 887 | rfkill->ops = ops; |
888 | rfkill->data = ops_data; | 888 | rfkill->data = ops_data; |
889 | 889 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 7ec667dd4ce1..b5c2cf2aa6d4 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -950,7 +950,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
950 | } | 950 | } |
951 | lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock); | 951 | lockdep_set_class(qdisc_lock(sch), &qdisc_tx_lock); |
952 | if (!netif_is_multiqueue(dev)) | 952 | if (!netif_is_multiqueue(dev)) |
953 | sch->flags |= TCQ_F_ONETXQUEUE | TCQ_F_NOPARENT; | 953 | sch->flags |= TCQ_F_ONETXQUEUE; |
954 | } | 954 | } |
955 | 955 | ||
956 | sch->handle = handle; | 956 | sch->handle = handle; |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index acb45b8c2a9d..ec529121f38a 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -323,14 +323,13 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr, | |||
323 | } | 323 | } |
324 | } | 324 | } |
325 | } | 325 | } |
326 | rcu_read_unlock(); | ||
327 | |||
328 | if (baddr) { | 326 | if (baddr) { |
329 | fl6->saddr = baddr->v6.sin6_addr; | 327 | fl6->saddr = baddr->v6.sin6_addr; |
330 | fl6->fl6_sport = baddr->v6.sin6_port; | 328 | fl6->fl6_sport = baddr->v6.sin6_port; |
331 | final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); | 329 | final_p = fl6_update_dst(fl6, rcu_dereference(np->opt), &final); |
332 | dst = ip6_dst_lookup_flow(sk, fl6, final_p); | 330 | dst = ip6_dst_lookup_flow(sk, fl6, final_p); |
333 | } | 331 | } |
332 | rcu_read_unlock(); | ||
334 | 333 | ||
335 | out: | 334 | out: |
336 | if (!IS_ERR_OR_NULL(dst)) { | 335 | if (!IS_ERR_OR_NULL(dst)) { |
@@ -642,6 +641,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
642 | struct sock *newsk; | 641 | struct sock *newsk; |
643 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 642 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
644 | struct sctp6_sock *newsctp6sk; | 643 | struct sctp6_sock *newsctp6sk; |
644 | struct ipv6_txoptions *opt; | ||
645 | 645 | ||
646 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot, 0); | 646 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot, 0); |
647 | if (!newsk) | 647 | if (!newsk) |
@@ -661,6 +661,13 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
661 | 661 | ||
662 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); | 662 | memcpy(newnp, np, sizeof(struct ipv6_pinfo)); |
663 | 663 | ||
664 | rcu_read_lock(); | ||
665 | opt = rcu_dereference(np->opt); | ||
666 | if (opt) | ||
667 | opt = ipv6_dup_options(newsk, opt); | ||
668 | RCU_INIT_POINTER(newnp->opt, opt); | ||
669 | rcu_read_unlock(); | ||
670 | |||
664 | /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() | 671 | /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() |
665 | * and getpeername(). | 672 | * and getpeername(). |
666 | */ | 673 | */ |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 7e8f0a117106..c0380cfb16ae 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -324,6 +324,7 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk) | |||
324 | sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) : | 324 | sctp_cname(SCTP_ST_CHUNK(chunk->chunk_hdr->type)) : |
325 | "illegal chunk"); | 325 | "illegal chunk"); |
326 | 326 | ||
327 | sctp_chunk_hold(chunk); | ||
327 | sctp_outq_tail_data(q, chunk); | 328 | sctp_outq_tail_data(q, chunk); |
328 | if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) | 329 | if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) |
329 | SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS); | 330 | SCTP_INC_STATS(net, SCTP_MIB_OUTUNORDERCHUNKS); |
@@ -1251,6 +1252,7 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) | |||
1251 | */ | 1252 | */ |
1252 | 1253 | ||
1253 | sack_a_rwnd = ntohl(sack->a_rwnd); | 1254 | sack_a_rwnd = ntohl(sack->a_rwnd); |
1255 | asoc->peer.zero_window_announced = !sack_a_rwnd; | ||
1254 | outstanding = q->outstanding_bytes; | 1256 | outstanding = q->outstanding_bytes; |
1255 | 1257 | ||
1256 | if (outstanding < sack_a_rwnd) | 1258 | if (outstanding < sack_a_rwnd) |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 763e06a55155..5d6a03fad378 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1652,7 +1652,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep, | |||
1652 | 1652 | ||
1653 | /* Set an expiration time for the cookie. */ | 1653 | /* Set an expiration time for the cookie. */ |
1654 | cookie->c.expiration = ktime_add(asoc->cookie_life, | 1654 | cookie->c.expiration = ktime_add(asoc->cookie_life, |
1655 | ktime_get()); | 1655 | ktime_get_real()); |
1656 | 1656 | ||
1657 | /* Copy the peer's init packet. */ | 1657 | /* Copy the peer's init packet. */ |
1658 | memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr, | 1658 | memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr, |
@@ -1780,7 +1780,7 @@ no_hmac: | |||
1780 | if (sock_flag(ep->base.sk, SOCK_TIMESTAMP)) | 1780 | if (sock_flag(ep->base.sk, SOCK_TIMESTAMP)) |
1781 | kt = skb_get_ktime(skb); | 1781 | kt = skb_get_ktime(skb); |
1782 | else | 1782 | else |
1783 | kt = ktime_get(); | 1783 | kt = ktime_get_real(); |
1784 | 1784 | ||
1785 | if (!asoc && ktime_before(bear_cookie->expiration, kt)) { | 1785 | if (!asoc && ktime_before(bear_cookie->expiration, kt)) { |
1786 | /* | 1786 | /* |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 6f46aa16cb76..cd34a4a34065 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -5412,7 +5412,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(struct net *net, | |||
5412 | SCTP_INC_STATS(net, SCTP_MIB_T3_RTX_EXPIREDS); | 5412 | SCTP_INC_STATS(net, SCTP_MIB_T3_RTX_EXPIREDS); |
5413 | 5413 | ||
5414 | if (asoc->overall_error_count >= asoc->max_retrans) { | 5414 | if (asoc->overall_error_count >= asoc->max_retrans) { |
5415 | if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING) { | 5415 | if (asoc->peer.zero_window_announced && |
5416 | asoc->state == SCTP_STATE_SHUTDOWN_PENDING) { | ||
5416 | /* | 5417 | /* |
5417 | * We are here likely because the receiver had its rwnd | 5418 | * We are here likely because the receiver had its rwnd |
5418 | * closed for a while and we have not been able to | 5419 | * closed for a while and we have not been able to |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 106bb09636f1..2a1e8ba2808c 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1952,8 +1952,6 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) | |||
1952 | 1952 | ||
1953 | /* Now send the (possibly) fragmented message. */ | 1953 | /* Now send the (possibly) fragmented message. */ |
1954 | list_for_each_entry(chunk, &datamsg->chunks, frag_list) { | 1954 | list_for_each_entry(chunk, &datamsg->chunks, frag_list) { |
1955 | sctp_chunk_hold(chunk); | ||
1956 | |||
1957 | /* Do accounting for the write space. */ | 1955 | /* Do accounting for the write space. */ |
1958 | sctp_set_owner_w(chunk); | 1956 | sctp_set_owner_w(chunk); |
1959 | 1957 | ||
@@ -1966,15 +1964,13 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) | |||
1966 | * breaks. | 1964 | * breaks. |
1967 | */ | 1965 | */ |
1968 | err = sctp_primitive_SEND(net, asoc, datamsg); | 1966 | err = sctp_primitive_SEND(net, asoc, datamsg); |
1967 | sctp_datamsg_put(datamsg); | ||
1969 | /* Did the lower layer accept the chunk? */ | 1968 | /* Did the lower layer accept the chunk? */ |
1970 | if (err) { | 1969 | if (err) |
1971 | sctp_datamsg_free(datamsg); | ||
1972 | goto out_free; | 1970 | goto out_free; |
1973 | } | ||
1974 | 1971 | ||
1975 | pr_debug("%s: we sent primitively\n", __func__); | 1972 | pr_debug("%s: we sent primitively\n", __func__); |
1976 | 1973 | ||
1977 | sctp_datamsg_put(datamsg); | ||
1978 | err = msg_len; | 1974 | err = msg_len; |
1979 | 1975 | ||
1980 | if (unlikely(wait_connect)) { | 1976 | if (unlikely(wait_connect)) { |
@@ -7167,6 +7163,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, | |||
7167 | newsk->sk_type = sk->sk_type; | 7163 | newsk->sk_type = sk->sk_type; |
7168 | newsk->sk_bound_dev_if = sk->sk_bound_dev_if; | 7164 | newsk->sk_bound_dev_if = sk->sk_bound_dev_if; |
7169 | newsk->sk_flags = sk->sk_flags; | 7165 | newsk->sk_flags = sk->sk_flags; |
7166 | newsk->sk_tsflags = sk->sk_tsflags; | ||
7170 | newsk->sk_no_check_tx = sk->sk_no_check_tx; | 7167 | newsk->sk_no_check_tx = sk->sk_no_check_tx; |
7171 | newsk->sk_no_check_rx = sk->sk_no_check_rx; | 7168 | newsk->sk_no_check_rx = sk->sk_no_check_rx; |
7172 | newsk->sk_reuse = sk->sk_reuse; | 7169 | newsk->sk_reuse = sk->sk_reuse; |
@@ -7199,6 +7196,9 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, | |||
7199 | newinet->mc_ttl = 1; | 7196 | newinet->mc_ttl = 1; |
7200 | newinet->mc_index = 0; | 7197 | newinet->mc_index = 0; |
7201 | newinet->mc_list = NULL; | 7198 | newinet->mc_list = NULL; |
7199 | |||
7200 | if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) | ||
7201 | net_enable_timestamp(); | ||
7202 | } | 7202 | } |
7203 | 7203 | ||
7204 | static inline void sctp_copy_descendant(struct sock *sk_to, | 7204 | static inline void sctp_copy_descendant(struct sock *sk_to, |
diff --git a/net/socket.c b/net/socket.c index 456fadb3d819..29822d6dd91e 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1695,6 +1695,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, | |||
1695 | msg.msg_name = addr ? (struct sockaddr *)&address : NULL; | 1695 | msg.msg_name = addr ? (struct sockaddr *)&address : NULL; |
1696 | /* We assume all kernel code knows the size of sockaddr_storage */ | 1696 | /* We assume all kernel code knows the size of sockaddr_storage */ |
1697 | msg.msg_namelen = 0; | 1697 | msg.msg_namelen = 0; |
1698 | msg.msg_iocb = NULL; | ||
1698 | if (sock->file->f_flags & O_NONBLOCK) | 1699 | if (sock->file->f_flags & O_NONBLOCK) |
1699 | flags |= MSG_DONTWAIT; | 1700 | flags |= MSG_DONTWAIT; |
1700 | err = sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags); | 1701 | err = sock_recvmsg(sock, &msg, iov_iter_count(&msg.msg_iter), flags); |
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c index 95f82d8d4888..229956bf8457 100644 --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c | |||
@@ -353,20 +353,12 @@ void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied) | |||
353 | { | 353 | { |
354 | struct rpc_xprt *xprt = req->rq_xprt; | 354 | struct rpc_xprt *xprt = req->rq_xprt; |
355 | struct svc_serv *bc_serv = xprt->bc_serv; | 355 | struct svc_serv *bc_serv = xprt->bc_serv; |
356 | struct xdr_buf *rq_rcv_buf = &req->rq_rcv_buf; | ||
357 | 356 | ||
358 | spin_lock(&xprt->bc_pa_lock); | 357 | spin_lock(&xprt->bc_pa_lock); |
359 | list_del(&req->rq_bc_pa_list); | 358 | list_del(&req->rq_bc_pa_list); |
360 | xprt_dec_alloc_count(xprt, 1); | 359 | xprt_dec_alloc_count(xprt, 1); |
361 | spin_unlock(&xprt->bc_pa_lock); | 360 | spin_unlock(&xprt->bc_pa_lock); |
362 | 361 | ||
363 | if (copied <= rq_rcv_buf->head[0].iov_len) { | ||
364 | rq_rcv_buf->head[0].iov_len = copied; | ||
365 | rq_rcv_buf->page_len = 0; | ||
366 | } else { | ||
367 | rq_rcv_buf->page_len = copied - rq_rcv_buf->head[0].iov_len; | ||
368 | } | ||
369 | |||
370 | req->rq_private_buf.len = copied; | 362 | req->rq_private_buf.len = copied; |
371 | set_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); | 363 | set_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); |
372 | 364 | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index f14f24ee9983..73ad57a59989 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -250,11 +250,11 @@ void rpc_destroy_wait_queue(struct rpc_wait_queue *queue) | |||
250 | } | 250 | } |
251 | EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue); | 251 | EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue); |
252 | 252 | ||
253 | static int rpc_wait_bit_killable(struct wait_bit_key *key) | 253 | static int rpc_wait_bit_killable(struct wait_bit_key *key, int mode) |
254 | { | 254 | { |
255 | if (fatal_signal_pending(current)) | ||
256 | return -ERESTARTSYS; | ||
257 | freezable_schedule_unsafe(); | 255 | freezable_schedule_unsafe(); |
256 | if (signal_pending_state(mode, current)) | ||
257 | return -ERESTARTSYS; | ||
258 | return 0; | 258 | return 0; |
259 | } | 259 | } |
260 | 260 | ||
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 7fccf9675df8..cc9852897395 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -1363,7 +1363,19 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, | |||
1363 | memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); | 1363 | memcpy(&rqstp->rq_addr, &req->rq_xprt->addr, rqstp->rq_addrlen); |
1364 | memcpy(&rqstp->rq_arg, &req->rq_rcv_buf, sizeof(rqstp->rq_arg)); | 1364 | memcpy(&rqstp->rq_arg, &req->rq_rcv_buf, sizeof(rqstp->rq_arg)); |
1365 | memcpy(&rqstp->rq_res, &req->rq_snd_buf, sizeof(rqstp->rq_res)); | 1365 | memcpy(&rqstp->rq_res, &req->rq_snd_buf, sizeof(rqstp->rq_res)); |
1366 | |||
1367 | /* Adjust the argument buffer length */ | ||
1366 | rqstp->rq_arg.len = req->rq_private_buf.len; | 1368 | rqstp->rq_arg.len = req->rq_private_buf.len; |
1369 | if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len) { | ||
1370 | rqstp->rq_arg.head[0].iov_len = rqstp->rq_arg.len; | ||
1371 | rqstp->rq_arg.page_len = 0; | ||
1372 | } else if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len + | ||
1373 | rqstp->rq_arg.page_len) | ||
1374 | rqstp->rq_arg.page_len = rqstp->rq_arg.len - | ||
1375 | rqstp->rq_arg.head[0].iov_len; | ||
1376 | else | ||
1377 | rqstp->rq_arg.len = rqstp->rq_arg.head[0].iov_len + | ||
1378 | rqstp->rq_arg.page_len; | ||
1367 | 1379 | ||
1368 | /* reset result send buffer "put" position */ | 1380 | /* reset result send buffer "put" position */ |
1369 | resv->iov_len = 0; | 1381 | resv->iov_len = 0; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 1c3c1f3a3ec4..b1314c099417 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2263,14 +2263,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) | |||
2263 | /* Lock the socket to prevent queue disordering | 2263 | /* Lock the socket to prevent queue disordering |
2264 | * while sleeps in memcpy_tomsg | 2264 | * while sleeps in memcpy_tomsg |
2265 | */ | 2265 | */ |
2266 | err = mutex_lock_interruptible(&u->readlock); | 2266 | mutex_lock(&u->readlock); |
2267 | if (unlikely(err)) { | ||
2268 | /* recvmsg() in non blocking mode is supposed to return -EAGAIN | ||
2269 | * sk_rcvtimeo is not honored by mutex_lock_interruptible() | ||
2270 | */ | ||
2271 | err = noblock ? -EAGAIN : -ERESTARTSYS; | ||
2272 | goto out; | ||
2273 | } | ||
2274 | 2267 | ||
2275 | if (flags & MSG_PEEK) | 2268 | if (flags & MSG_PEEK) |
2276 | skip = sk_peek_offset(sk, flags); | 2269 | skip = sk_peek_offset(sk, flags); |
@@ -2314,12 +2307,12 @@ again: | |||
2314 | timeo = unix_stream_data_wait(sk, timeo, last, | 2307 | timeo = unix_stream_data_wait(sk, timeo, last, |
2315 | last_len); | 2308 | last_len); |
2316 | 2309 | ||
2317 | if (signal_pending(current) || | 2310 | if (signal_pending(current)) { |
2318 | mutex_lock_interruptible(&u->readlock)) { | ||
2319 | err = sock_intr_errno(timeo); | 2311 | err = sock_intr_errno(timeo); |
2320 | goto out; | 2312 | goto out; |
2321 | } | 2313 | } |
2322 | 2314 | ||
2315 | mutex_lock(&u->readlock); | ||
2323 | continue; | 2316 | continue; |
2324 | unlock: | 2317 | unlock: |
2325 | unix_state_unlock(sk); | 2318 | unix_state_unlock(sk); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 72de6989dd12..d4786f2802aa 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -7973,8 +7973,10 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
7973 | if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { | 7973 | if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { |
7974 | if (!(rdev->wiphy.features & | 7974 | if (!(rdev->wiphy.features & |
7975 | NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) || | 7975 | NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) || |
7976 | !(rdev->wiphy.features & NL80211_FEATURE_QUIET)) | 7976 | !(rdev->wiphy.features & NL80211_FEATURE_QUIET)) { |
7977 | kzfree(connkeys); | ||
7977 | return -EINVAL; | 7978 | return -EINVAL; |
7979 | } | ||
7978 | connect.flags |= ASSOC_REQ_USE_RRM; | 7980 | connect.flags |= ASSOC_REQ_USE_RRM; |
7979 | } | 7981 | } |
7980 | 7982 | ||
@@ -9535,6 +9537,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
9535 | if (new_triggers.tcp && new_triggers.tcp->sock) | 9537 | if (new_triggers.tcp && new_triggers.tcp->sock) |
9536 | sock_release(new_triggers.tcp->sock); | 9538 | sock_release(new_triggers.tcp->sock); |
9537 | kfree(new_triggers.tcp); | 9539 | kfree(new_triggers.tcp); |
9540 | kfree(new_triggers.nd_config); | ||
9538 | return err; | 9541 | return err; |
9539 | } | 9542 | } |
9540 | #endif | 9543 | #endif |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 0a4f5481ab83..3b0ce1c484a3 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -3011,6 +3011,7 @@ int set_regdom(const struct ieee80211_regdomain *rd, | |||
3011 | break; | 3011 | break; |
3012 | default: | 3012 | default: |
3013 | WARN(1, "invalid initiator %d\n", lr->initiator); | 3013 | WARN(1, "invalid initiator %d\n", lr->initiator); |
3014 | kfree(rd); | ||
3014 | return -EINVAL; | 3015 | return -EINVAL; |
3015 | } | 3016 | } |
3016 | 3017 | ||
@@ -3203,8 +3204,10 @@ int __init regulatory_init(void) | |||
3203 | /* We always try to get an update for the static regdomain */ | 3204 | /* We always try to get an update for the static regdomain */ |
3204 | err = regulatory_hint_core(cfg80211_world_regdom->alpha2); | 3205 | err = regulatory_hint_core(cfg80211_world_regdom->alpha2); |
3205 | if (err) { | 3206 | if (err) { |
3206 | if (err == -ENOMEM) | 3207 | if (err == -ENOMEM) { |
3208 | platform_device_unregister(reg_pdev); | ||
3207 | return err; | 3209 | return err; |
3210 | } | ||
3208 | /* | 3211 | /* |
3209 | * N.B. kobject_uevent_env() can fail mainly for when we're out | 3212 | * N.B. kobject_uevent_env() can fail mainly for when we're out |
3210 | * memory which is handled and propagated appropriately above | 3213 | * memory which is handled and propagated appropriately above |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 09bfcbac63bb..948fa5560de5 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -303,6 +303,14 @@ struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp) | |||
303 | } | 303 | } |
304 | EXPORT_SYMBOL(xfrm_policy_alloc); | 304 | EXPORT_SYMBOL(xfrm_policy_alloc); |
305 | 305 | ||
306 | static void xfrm_policy_destroy_rcu(struct rcu_head *head) | ||
307 | { | ||
308 | struct xfrm_policy *policy = container_of(head, struct xfrm_policy, rcu); | ||
309 | |||
310 | security_xfrm_policy_free(policy->security); | ||
311 | kfree(policy); | ||
312 | } | ||
313 | |||
306 | /* Destroy xfrm_policy: descendant resources must be released to this moment. */ | 314 | /* Destroy xfrm_policy: descendant resources must be released to this moment. */ |
307 | 315 | ||
308 | void xfrm_policy_destroy(struct xfrm_policy *policy) | 316 | void xfrm_policy_destroy(struct xfrm_policy *policy) |
@@ -312,8 +320,7 @@ void xfrm_policy_destroy(struct xfrm_policy *policy) | |||
312 | if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer)) | 320 | if (del_timer(&policy->timer) || del_timer(&policy->polq.hold_timer)) |
313 | BUG(); | 321 | BUG(); |
314 | 322 | ||
315 | security_xfrm_policy_free(policy->security); | 323 | call_rcu(&policy->rcu, xfrm_policy_destroy_rcu); |
316 | kfree(policy); | ||
317 | } | 324 | } |
318 | EXPORT_SYMBOL(xfrm_policy_destroy); | 325 | EXPORT_SYMBOL(xfrm_policy_destroy); |
319 | 326 | ||
@@ -1214,8 +1221,10 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, | |||
1214 | struct xfrm_policy *pol; | 1221 | struct xfrm_policy *pol; |
1215 | struct net *net = sock_net(sk); | 1222 | struct net *net = sock_net(sk); |
1216 | 1223 | ||
1224 | rcu_read_lock(); | ||
1217 | read_lock_bh(&net->xfrm.xfrm_policy_lock); | 1225 | read_lock_bh(&net->xfrm.xfrm_policy_lock); |
1218 | if ((pol = sk->sk_policy[dir]) != NULL) { | 1226 | pol = rcu_dereference(sk->sk_policy[dir]); |
1227 | if (pol != NULL) { | ||
1219 | bool match = xfrm_selector_match(&pol->selector, fl, | 1228 | bool match = xfrm_selector_match(&pol->selector, fl, |
1220 | sk->sk_family); | 1229 | sk->sk_family); |
1221 | int err = 0; | 1230 | int err = 0; |
@@ -1239,6 +1248,7 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(const struct sock *sk, int dir, | |||
1239 | } | 1248 | } |
1240 | out: | 1249 | out: |
1241 | read_unlock_bh(&net->xfrm.xfrm_policy_lock); | 1250 | read_unlock_bh(&net->xfrm.xfrm_policy_lock); |
1251 | rcu_read_unlock(); | ||
1242 | return pol; | 1252 | return pol; |
1243 | } | 1253 | } |
1244 | 1254 | ||
@@ -1307,13 +1317,14 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol) | |||
1307 | #endif | 1317 | #endif |
1308 | 1318 | ||
1309 | write_lock_bh(&net->xfrm.xfrm_policy_lock); | 1319 | write_lock_bh(&net->xfrm.xfrm_policy_lock); |
1310 | old_pol = sk->sk_policy[dir]; | 1320 | old_pol = rcu_dereference_protected(sk->sk_policy[dir], |
1311 | sk->sk_policy[dir] = pol; | 1321 | lockdep_is_held(&net->xfrm.xfrm_policy_lock)); |
1312 | if (pol) { | 1322 | if (pol) { |
1313 | pol->curlft.add_time = get_seconds(); | 1323 | pol->curlft.add_time = get_seconds(); |
1314 | pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0); | 1324 | pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0); |
1315 | xfrm_sk_policy_link(pol, dir); | 1325 | xfrm_sk_policy_link(pol, dir); |
1316 | } | 1326 | } |
1327 | rcu_assign_pointer(sk->sk_policy[dir], pol); | ||
1317 | if (old_pol) { | 1328 | if (old_pol) { |
1318 | if (pol) | 1329 | if (pol) |
1319 | xfrm_policy_requeue(old_pol, pol); | 1330 | xfrm_policy_requeue(old_pol, pol); |
@@ -1361,17 +1372,26 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir) | |||
1361 | return newp; | 1372 | return newp; |
1362 | } | 1373 | } |
1363 | 1374 | ||
1364 | int __xfrm_sk_clone_policy(struct sock *sk) | 1375 | int __xfrm_sk_clone_policy(struct sock *sk, const struct sock *osk) |
1365 | { | 1376 | { |
1366 | struct xfrm_policy *p0 = sk->sk_policy[0], | 1377 | const struct xfrm_policy *p; |
1367 | *p1 = sk->sk_policy[1]; | 1378 | struct xfrm_policy *np; |
1379 | int i, ret = 0; | ||
1368 | 1380 | ||
1369 | sk->sk_policy[0] = sk->sk_policy[1] = NULL; | 1381 | rcu_read_lock(); |
1370 | if (p0 && (sk->sk_policy[0] = clone_policy(p0, 0)) == NULL) | 1382 | for (i = 0; i < 2; i++) { |
1371 | return -ENOMEM; | 1383 | p = rcu_dereference(osk->sk_policy[i]); |
1372 | if (p1 && (sk->sk_policy[1] = clone_policy(p1, 1)) == NULL) | 1384 | if (p) { |
1373 | return -ENOMEM; | 1385 | np = clone_policy(p, i); |
1374 | return 0; | 1386 | if (unlikely(!np)) { |
1387 | ret = -ENOMEM; | ||
1388 | break; | ||
1389 | } | ||
1390 | rcu_assign_pointer(sk->sk_policy[i], np); | ||
1391 | } | ||
1392 | } | ||
1393 | rcu_read_unlock(); | ||
1394 | return ret; | ||
1375 | } | 1395 | } |
1376 | 1396 | ||
1377 | static int | 1397 | static int |
@@ -2198,6 +2218,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
2198 | xdst = NULL; | 2218 | xdst = NULL; |
2199 | route = NULL; | 2219 | route = NULL; |
2200 | 2220 | ||
2221 | sk = sk_const_to_full_sk(sk); | ||
2201 | if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { | 2222 | if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { |
2202 | num_pols = 1; | 2223 | num_pols = 1; |
2203 | pols[0] = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); | 2224 | pols[0] = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); |
@@ -2477,6 +2498,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, | |||
2477 | } | 2498 | } |
2478 | 2499 | ||
2479 | pol = NULL; | 2500 | pol = NULL; |
2501 | sk = sk_to_full_sk(sk); | ||
2480 | if (sk && sk->sk_policy[dir]) { | 2502 | if (sk && sk->sk_policy[dir]) { |
2481 | pol = xfrm_sk_policy_lookup(sk, dir, &fl); | 2503 | pol = xfrm_sk_policy_lookup(sk, dir, &fl); |
2482 | if (IS_ERR(pol)) { | 2504 | if (IS_ERR(pol)) { |