diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-12-23 02:30:28 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-12-23 02:30:28 -0500 |
commit | 0fb0b822d157325b66c503d23332f64899bfb828 (patch) | |
tree | 0699437223be8c87a9c4951c46a5fe27681d57e5 /net | |
parent | 9f660a1c43890c2cdd1f423fd73654e7ca08fe56 (diff) | |
parent | 3dd5fc0eeb5d7cc07b8e3e383037261799b38897 (diff) |
Merge tag 'asoc-fix-v4.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.4
A collection of small driver specific fixes here, nothing that'll affect
users who don't have the devices concerned. At least the wm8974 bug
indicates that there's not too many users of some of these devices.
Diffstat (limited to 'net')
44 files changed, 347 insertions, 223 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 8d990b070a2e..3207667e69de 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 4228b10c47ea..76f19ba62462 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/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 e31dfcee1729..0d91f7dca751 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; |
@@ -1552,7 +1551,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | |||
1552 | */ | 1551 | */ |
1553 | is_charged = sk_filter_charge(newsk, filter); | 1552 | is_charged = sk_filter_charge(newsk, filter); |
1554 | 1553 | ||
1555 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk))) { | 1554 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { |
1556 | /* It is still raw copy of parent, so invalidate | 1555 | /* It is still raw copy of parent, so invalidate |
1557 | * destructor and make plain sk_free() */ | 1556 | * destructor and make plain sk_free() */ |
1558 | newsk->sk_destruct = NULL; | 1557 | 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 db003438aaf5..d8841a2f1569 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 cb7ca569052c..9bfc39ff2285 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 61f26851655c..17f8e7ea133b 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); |
@@ -2455,7 +2461,7 @@ ok: | |||
2455 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD | 2461 | #ifdef CONFIG_IPV6_OPTIMISTIC_DAD |
2456 | if (in6_dev->cnf.optimistic_dad && | 2462 | if (in6_dev->cnf.optimistic_dad && |
2457 | !net->ipv6.devconf_all->forwarding && sllao) | 2463 | !net->ipv6.devconf_all->forwarding && sllao) |
2458 | addr_flags = IFA_F_OPTIMISTIC; | 2464 | addr_flags |= IFA_F_OPTIMISTIC; |
2459 | #endif | 2465 | #endif |
2460 | 2466 | ||
2461 | /* Do not allow to create too much of autoconfigured | 2467 | /* 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 3c7b9310b33f..e5ea177d34c6 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -1571,13 +1571,11 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], | |||
1571 | return -EEXIST; | 1571 | return -EEXIST; |
1572 | } else { | 1572 | } else { |
1573 | t = nt; | 1573 | t = nt; |
1574 | |||
1575 | ip6gre_tunnel_unlink(ign, t); | ||
1576 | ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); | ||
1577 | ip6gre_tunnel_link(ign, t); | ||
1578 | netdev_state_change(dev); | ||
1579 | } | 1574 | } |
1580 | 1575 | ||
1576 | ip6gre_tunnel_unlink(ign, t); | ||
1577 | ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); | ||
1578 | ip6gre_tunnel_link(ign, t); | ||
1581 | return 0; | 1579 | return 0; |
1582 | } | 1580 | } |
1583 | 1581 | ||
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 e7aab561b7b4..6b8a8a9091fa 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 da471eef07bb..c12f348138ac 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 d832bd59236b..5322b4c71630 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1709,10 +1709,10 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); | |||
1709 | void ieee80211_sta_set_rx_nss(struct sta_info *sta); | 1709 | void ieee80211_sta_set_rx_nss(struct sta_info *sta); |
1710 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 1710 | u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
1711 | struct sta_info *sta, u8 opmode, | 1711 | struct sta_info *sta, u8 opmode, |
1712 | enum ieee80211_band band, bool nss_only); | 1712 | enum ieee80211_band band); |
1713 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, | 1713 | void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, |
1714 | struct sta_info *sta, u8 opmode, | 1714 | struct sta_info *sta, u8 opmode, |
1715 | enum ieee80211_band band, bool nss_only); | 1715 | enum ieee80211_band band); |
1716 | void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, | 1716 | void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, |
1717 | struct ieee80211_sta_vht_cap *vht_cap); | 1717 | struct ieee80211_sta_vht_cap *vht_cap); |
1718 | void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, | 1718 | void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index b140cc6651f4..3aa04344942b 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; |
@@ -3575,7 +3580,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
3575 | 3580 | ||
3576 | if (sta && elems.opmode_notif) | 3581 | if (sta && elems.opmode_notif) |
3577 | ieee80211_vht_handle_opmode(sdata, sta, *elems.opmode_notif, | 3582 | ieee80211_vht_handle_opmode(sdata, sta, *elems.opmode_notif, |
3578 | rx_status->band, true); | 3583 | rx_status->band); |
3579 | mutex_unlock(&local->sta_mtx); | 3584 | mutex_unlock(&local->sta_mtx); |
3580 | 3585 | ||
3581 | changed |= ieee80211_handle_pwr_constr(sdata, chan, mgmt, | 3586 | changed |= ieee80211_handle_pwr_constr(sdata, chan, mgmt, |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 8bae5de0dc44..82af407fea7a 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -2736,8 +2736,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2736 | opmode = mgmt->u.action.u.vht_opmode_notif.operating_mode; | 2736 | opmode = mgmt->u.action.u.vht_opmode_notif.operating_mode; |
2737 | 2737 | ||
2738 | ieee80211_vht_handle_opmode(rx->sdata, rx->sta, | 2738 | ieee80211_vht_handle_opmode(rx->sdata, rx->sta, |
2739 | opmode, status->band, | 2739 | opmode, status->band); |
2740 | false); | ||
2741 | goto handled; | 2740 | goto handled; |
2742 | } | 2741 | } |
2743 | default: | 2742 | default: |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 74058020b7d6..33344f5a66a8 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1641,6 +1641,29 @@ void ieee80211_stop_device(struct ieee80211_local *local) | |||
1641 | drv_stop(local); | 1641 | drv_stop(local); |
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | static void ieee80211_flush_completed_scan(struct ieee80211_local *local, | ||
1645 | bool aborted) | ||
1646 | { | ||
1647 | /* It's possible that we don't handle the scan completion in | ||
1648 | * time during suspend, so if it's still marked as completed | ||
1649 | * here, queue the work and flush it to clean things up. | ||
1650 | * Instead of calling the worker function directly here, we | ||
1651 | * really queue it to avoid potential races with other flows | ||
1652 | * scheduling the same work. | ||
1653 | */ | ||
1654 | if (test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
1655 | /* If coming from reconfiguration failure, abort the scan so | ||
1656 | * we don't attempt to continue a partial HW scan - which is | ||
1657 | * possible otherwise if (e.g.) the 2.4 GHz portion was the | ||
1658 | * completed scan, and a 5 GHz portion is still pending. | ||
1659 | */ | ||
1660 | if (aborted) | ||
1661 | set_bit(SCAN_ABORTED, &local->scanning); | ||
1662 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
1663 | flush_delayed_work(&local->scan_work); | ||
1664 | } | ||
1665 | } | ||
1666 | |||
1644 | static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) | 1667 | static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) |
1645 | { | 1668 | { |
1646 | struct ieee80211_sub_if_data *sdata; | 1669 | struct ieee80211_sub_if_data *sdata; |
@@ -1660,6 +1683,8 @@ static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local) | |||
1660 | local->suspended = false; | 1683 | local->suspended = false; |
1661 | local->in_reconfig = false; | 1684 | local->in_reconfig = false; |
1662 | 1685 | ||
1686 | ieee80211_flush_completed_scan(local, true); | ||
1687 | |||
1663 | /* scheduled scan clearly can't be running any more, but tell | 1688 | /* scheduled scan clearly can't be running any more, but tell |
1664 | * cfg80211 and clear local state | 1689 | * cfg80211 and clear local state |
1665 | */ | 1690 | */ |
@@ -1698,6 +1723,27 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local, | |||
1698 | mutex_unlock(&local->chanctx_mtx); | 1723 | mutex_unlock(&local->chanctx_mtx); |
1699 | } | 1724 | } |
1700 | 1725 | ||
1726 | static void ieee80211_reconfig_stations(struct ieee80211_sub_if_data *sdata) | ||
1727 | { | ||
1728 | struct ieee80211_local *local = sdata->local; | ||
1729 | struct sta_info *sta; | ||
1730 | |||
1731 | /* add STAs back */ | ||
1732 | mutex_lock(&local->sta_mtx); | ||
1733 | list_for_each_entry(sta, &local->sta_list, list) { | ||
1734 | enum ieee80211_sta_state state; | ||
1735 | |||
1736 | if (!sta->uploaded || sta->sdata != sdata) | ||
1737 | continue; | ||
1738 | |||
1739 | for (state = IEEE80211_STA_NOTEXIST; | ||
1740 | state < sta->sta_state; state++) | ||
1741 | WARN_ON(drv_sta_state(local, sta->sdata, sta, state, | ||
1742 | state + 1)); | ||
1743 | } | ||
1744 | mutex_unlock(&local->sta_mtx); | ||
1745 | } | ||
1746 | |||
1701 | int ieee80211_reconfig(struct ieee80211_local *local) | 1747 | int ieee80211_reconfig(struct ieee80211_local *local) |
1702 | { | 1748 | { |
1703 | struct ieee80211_hw *hw = &local->hw; | 1749 | struct ieee80211_hw *hw = &local->hw; |
@@ -1833,50 +1879,11 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1833 | WARN_ON(drv_add_chanctx(local, ctx)); | 1879 | WARN_ON(drv_add_chanctx(local, ctx)); |
1834 | mutex_unlock(&local->chanctx_mtx); | 1880 | mutex_unlock(&local->chanctx_mtx); |
1835 | 1881 | ||
1836 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1837 | if (!ieee80211_sdata_running(sdata)) | ||
1838 | continue; | ||
1839 | ieee80211_assign_chanctx(local, sdata); | ||
1840 | } | ||
1841 | |||
1842 | sdata = rtnl_dereference(local->monitor_sdata); | 1882 | sdata = rtnl_dereference(local->monitor_sdata); |
1843 | if (sdata && ieee80211_sdata_running(sdata)) | 1883 | if (sdata && ieee80211_sdata_running(sdata)) |
1844 | ieee80211_assign_chanctx(local, sdata); | 1884 | ieee80211_assign_chanctx(local, sdata); |
1845 | } | 1885 | } |
1846 | 1886 | ||
1847 | /* add STAs back */ | ||
1848 | mutex_lock(&local->sta_mtx); | ||
1849 | list_for_each_entry(sta, &local->sta_list, list) { | ||
1850 | enum ieee80211_sta_state state; | ||
1851 | |||
1852 | if (!sta->uploaded) | ||
1853 | continue; | ||
1854 | |||
1855 | /* AP-mode stations will be added later */ | ||
1856 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP) | ||
1857 | continue; | ||
1858 | |||
1859 | for (state = IEEE80211_STA_NOTEXIST; | ||
1860 | state < sta->sta_state; state++) | ||
1861 | WARN_ON(drv_sta_state(local, sta->sdata, sta, state, | ||
1862 | state + 1)); | ||
1863 | } | ||
1864 | mutex_unlock(&local->sta_mtx); | ||
1865 | |||
1866 | /* reconfigure tx conf */ | ||
1867 | if (hw->queues >= IEEE80211_NUM_ACS) { | ||
1868 | list_for_each_entry(sdata, &local->interfaces, list) { | ||
1869 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | ||
1870 | sdata->vif.type == NL80211_IFTYPE_MONITOR || | ||
1871 | !ieee80211_sdata_running(sdata)) | ||
1872 | continue; | ||
1873 | |||
1874 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
1875 | drv_conf_tx(local, sdata, i, | ||
1876 | &sdata->tx_conf[i]); | ||
1877 | } | ||
1878 | } | ||
1879 | |||
1880 | /* reconfigure hardware */ | 1887 | /* reconfigure hardware */ |
1881 | ieee80211_hw_config(local, ~0); | 1888 | ieee80211_hw_config(local, ~0); |
1882 | 1889 | ||
@@ -1889,6 +1896,22 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1889 | if (!ieee80211_sdata_running(sdata)) | 1896 | if (!ieee80211_sdata_running(sdata)) |
1890 | continue; | 1897 | continue; |
1891 | 1898 | ||
1899 | ieee80211_assign_chanctx(local, sdata); | ||
1900 | |||
1901 | switch (sdata->vif.type) { | ||
1902 | case NL80211_IFTYPE_AP_VLAN: | ||
1903 | case NL80211_IFTYPE_MONITOR: | ||
1904 | break; | ||
1905 | default: | ||
1906 | ieee80211_reconfig_stations(sdata); | ||
1907 | /* fall through */ | ||
1908 | case NL80211_IFTYPE_AP: /* AP stations are handled later */ | ||
1909 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | ||
1910 | drv_conf_tx(local, sdata, i, | ||
1911 | &sdata->tx_conf[i]); | ||
1912 | break; | ||
1913 | } | ||
1914 | |||
1892 | /* common change flags for all interface types */ | 1915 | /* common change flags for all interface types */ |
1893 | changed = BSS_CHANGED_ERP_CTS_PROT | | 1916 | changed = BSS_CHANGED_ERP_CTS_PROT | |
1894 | BSS_CHANGED_ERP_PREAMBLE | | 1917 | BSS_CHANGED_ERP_PREAMBLE | |
@@ -2074,17 +2097,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
2074 | mb(); | 2097 | mb(); |
2075 | local->resuming = false; | 2098 | local->resuming = false; |
2076 | 2099 | ||
2077 | /* It's possible that we don't handle the scan completion in | 2100 | ieee80211_flush_completed_scan(local, false); |
2078 | * time during suspend, so if it's still marked as completed | ||
2079 | * here, queue the work and flush it to clean things up. | ||
2080 | * Instead of calling the worker function directly here, we | ||
2081 | * really queue it to avoid potential races with other flows | ||
2082 | * scheduling the same work. | ||
2083 | */ | ||
2084 | if (test_bit(SCAN_COMPLETED, &local->scanning)) { | ||
2085 | ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); | ||
2086 | flush_delayed_work(&local->scan_work); | ||
2087 | } | ||
2088 | 2101 | ||
2089 | if (local->open_count && !reconfig_due_to_wowlan) | 2102 | if (local->open_count && !reconfig_due_to_wowlan) |
2090 | drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_SUSPEND); | 2103 | 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 c70d750148b6..c32fc411a911 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 | ||
@@ -317,7 +319,13 @@ static int mpls_forward(struct sk_buff *skb, struct net_device *dev, | |||
317 | } | 319 | } |
318 | } | 320 | } |
319 | 321 | ||
320 | err = neigh_xmit(nh->nh_via_table, out_dev, mpls_nh_via(rt, nh), skb); | 322 | /* If via wasn't specified then send out using device address */ |
323 | if (nh->nh_via_table == MPLS_NEIGH_TABLE_UNSPEC) | ||
324 | err = neigh_xmit(NEIGH_LINK_TABLE, out_dev, | ||
325 | out_dev->dev_addr, skb); | ||
326 | else | ||
327 | err = neigh_xmit(nh->nh_via_table, out_dev, | ||
328 | mpls_nh_via(rt, nh), skb); | ||
321 | if (err) | 329 | if (err) |
322 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", | 330 | net_dbg_ratelimited("%s: packet transmission failed: %d\n", |
323 | __func__, err); | 331 | __func__, err); |
@@ -534,6 +542,10 @@ static int mpls_nh_assign_dev(struct net *net, struct mpls_route *rt, | |||
534 | if (!mpls_dev_get(dev)) | 542 | if (!mpls_dev_get(dev)) |
535 | goto errout; | 543 | goto errout; |
536 | 544 | ||
545 | if ((nh->nh_via_table == NEIGH_LINK_TABLE) && | ||
546 | (dev->addr_len != nh->nh_via_alen)) | ||
547 | goto errout; | ||
548 | |||
537 | RCU_INIT_POINTER(nh->nh_dev, dev); | 549 | RCU_INIT_POINTER(nh->nh_dev, dev); |
538 | 550 | ||
539 | return 0; | 551 | return 0; |
@@ -592,10 +604,14 @@ static int mpls_nh_build(struct net *net, struct mpls_route *rt, | |||
592 | goto errout; | 604 | goto errout; |
593 | } | 605 | } |
594 | 606 | ||
595 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, | 607 | if (via) { |
596 | __mpls_nh_via(rt, nh)); | 608 | err = nla_get_via(via, &nh->nh_via_alen, &nh->nh_via_table, |
597 | if (err) | 609 | __mpls_nh_via(rt, nh)); |
598 | goto errout; | 610 | if (err) |
611 | goto errout; | ||
612 | } else { | ||
613 | nh->nh_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
614 | } | ||
599 | 615 | ||
600 | err = mpls_nh_assign_dev(net, rt, nh, oif); | 616 | err = mpls_nh_assign_dev(net, rt, nh, oif); |
601 | if (err) | 617 | if (err) |
@@ -677,9 +693,6 @@ static int mpls_nh_build_multi(struct mpls_route_config *cfg, | |||
677 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); | 693 | nla_newdst = nla_find(attrs, attrlen, RTA_NEWDST); |
678 | } | 694 | } |
679 | 695 | ||
680 | if (!nla_via) | ||
681 | goto errout; | ||
682 | |||
683 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, | 696 | err = mpls_nh_build(cfg->rc_nlinfo.nl_net, rt, nh, |
684 | rtnh->rtnh_ifindex, nla_via, | 697 | rtnh->rtnh_ifindex, nla_via, |
685 | nla_newdst); | 698 | nla_newdst); |
@@ -1118,6 +1131,7 @@ static int rtm_to_route_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1118 | 1131 | ||
1119 | cfg->rc_label = LABEL_NOT_SPECIFIED; | 1132 | cfg->rc_label = LABEL_NOT_SPECIFIED; |
1120 | cfg->rc_protocol = rtm->rtm_protocol; | 1133 | cfg->rc_protocol = rtm->rtm_protocol; |
1134 | cfg->rc_via_table = MPLS_NEIGH_TABLE_UNSPEC; | ||
1121 | cfg->rc_nlflags = nlh->nlmsg_flags; | 1135 | cfg->rc_nlflags = nlh->nlmsg_flags; |
1122 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; | 1136 | cfg->rc_nlinfo.portid = NETLINK_CB(skb).portid; |
1123 | cfg->rc_nlinfo.nlh = nlh; | 1137 | cfg->rc_nlinfo.nlh = nlh; |
@@ -1231,7 +1245,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1231 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, | 1245 | nla_put_labels(skb, RTA_NEWDST, nh->nh_labels, |
1232 | nh->nh_label)) | 1246 | nh->nh_label)) |
1233 | goto nla_put_failure; | 1247 | goto nla_put_failure; |
1234 | if (nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | 1248 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
1249 | nla_put_via(skb, nh->nh_via_table, mpls_nh_via(rt, nh), | ||
1235 | nh->nh_via_alen)) | 1250 | nh->nh_via_alen)) |
1236 | goto nla_put_failure; | 1251 | goto nla_put_failure; |
1237 | dev = rtnl_dereference(nh->nh_dev); | 1252 | dev = rtnl_dereference(nh->nh_dev); |
@@ -1257,7 +1272,8 @@ static int mpls_dump_route(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1257 | nh->nh_labels, | 1272 | nh->nh_labels, |
1258 | nh->nh_label)) | 1273 | nh->nh_label)) |
1259 | goto nla_put_failure; | 1274 | goto nla_put_failure; |
1260 | if (nla_put_via(skb, nh->nh_via_table, | 1275 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC && |
1276 | nla_put_via(skb, nh->nh_via_table, | ||
1261 | mpls_nh_via(rt, nh), | 1277 | mpls_nh_via(rt, nh), |
1262 | nh->nh_via_alen)) | 1278 | nh->nh_via_alen)) |
1263 | goto nla_put_failure; | 1279 | goto nla_put_failure; |
@@ -1319,7 +1335,8 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) | |||
1319 | 1335 | ||
1320 | if (nh->nh_dev) | 1336 | if (nh->nh_dev) |
1321 | payload += nla_total_size(4); /* RTA_OIF */ | 1337 | payload += nla_total_size(4); /* RTA_OIF */ |
1322 | payload += nla_total_size(2 + nh->nh_via_alen); /* RTA_VIA */ | 1338 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) /* RTA_VIA */ |
1339 | payload += nla_total_size(2 + nh->nh_via_alen); | ||
1323 | if (nh->nh_labels) /* RTA_NEWDST */ | 1340 | if (nh->nh_labels) /* RTA_NEWDST */ |
1324 | payload += nla_total_size(nh->nh_labels * 4); | 1341 | payload += nla_total_size(nh->nh_labels * 4); |
1325 | } else { | 1342 | } else { |
@@ -1328,7 +1345,9 @@ static inline size_t lfib_nlmsg_size(struct mpls_route *rt) | |||
1328 | 1345 | ||
1329 | for_nexthops(rt) { | 1346 | for_nexthops(rt) { |
1330 | nhsize += nla_total_size(sizeof(struct rtnexthop)); | 1347 | nhsize += nla_total_size(sizeof(struct rtnexthop)); |
1331 | nhsize += nla_total_size(2 + nh->nh_via_alen); | 1348 | /* RTA_VIA */ |
1349 | if (nh->nh_via_table != MPLS_NEIGH_TABLE_UNSPEC) | ||
1350 | nhsize += nla_total_size(2 + nh->nh_via_alen); | ||
1332 | if (nh->nh_labels) | 1351 | if (nh->nh_labels) |
1333 | nhsize += nla_total_size(nh->nh_labels * 4); | 1352 | nhsize += nla_total_size(nh->nh_labels * 4); |
1334 | } endfor_nexthops(rt); | 1353 | } endfor_nexthops(rt); |
diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c index 67591aef9cae..64afd3d0b144 100644 --- a/net/mpls/mpls_iptunnel.c +++ b/net/mpls/mpls_iptunnel.c | |||
@@ -54,10 +54,10 @@ 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 03c8256063ec..9b6cc6de80d8 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/unix/af_unix.c b/net/unix/af_unix.c index 45aebd966978..a4631477cedf 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2256,14 +2256,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) | |||
2256 | /* Lock the socket to prevent queue disordering | 2256 | /* Lock the socket to prevent queue disordering |
2257 | * while sleeps in memcpy_tomsg | 2257 | * while sleeps in memcpy_tomsg |
2258 | */ | 2258 | */ |
2259 | err = mutex_lock_interruptible(&u->readlock); | 2259 | mutex_lock(&u->readlock); |
2260 | if (unlikely(err)) { | ||
2261 | /* recvmsg() in non blocking mode is supposed to return -EAGAIN | ||
2262 | * sk_rcvtimeo is not honored by mutex_lock_interruptible() | ||
2263 | */ | ||
2264 | err = noblock ? -EAGAIN : -ERESTARTSYS; | ||
2265 | goto out; | ||
2266 | } | ||
2267 | 2260 | ||
2268 | if (flags & MSG_PEEK) | 2261 | if (flags & MSG_PEEK) |
2269 | skip = sk_peek_offset(sk, flags); | 2262 | skip = sk_peek_offset(sk, flags); |
@@ -2307,12 +2300,12 @@ again: | |||
2307 | timeo = unix_stream_data_wait(sk, timeo, last, | 2300 | timeo = unix_stream_data_wait(sk, timeo, last, |
2308 | last_len); | 2301 | last_len); |
2309 | 2302 | ||
2310 | if (signal_pending(current) || | 2303 | if (signal_pending(current)) { |
2311 | mutex_lock_interruptible(&u->readlock)) { | ||
2312 | err = sock_intr_errno(timeo); | 2304 | err = sock_intr_errno(timeo); |
2313 | goto out; | 2305 | goto out; |
2314 | } | 2306 | } |
2315 | 2307 | ||
2308 | mutex_lock(&u->readlock); | ||
2316 | continue; | 2309 | continue; |
2317 | unlock: | 2310 | unlock: |
2318 | unix_state_unlock(sk); | 2311 | unix_state_unlock(sk); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c71e274c810a..75b0d23ee882 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -7941,8 +7941,10 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
7941 | if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { | 7941 | if (nla_get_flag(info->attrs[NL80211_ATTR_USE_RRM])) { |
7942 | if (!(rdev->wiphy.features & | 7942 | if (!(rdev->wiphy.features & |
7943 | NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) || | 7943 | NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES) || |
7944 | !(rdev->wiphy.features & NL80211_FEATURE_QUIET)) | 7944 | !(rdev->wiphy.features & NL80211_FEATURE_QUIET)) { |
7945 | kzfree(connkeys); | ||
7945 | return -EINVAL; | 7946 | return -EINVAL; |
7947 | } | ||
7946 | connect.flags |= ASSOC_REQ_USE_RRM; | 7948 | connect.flags |= ASSOC_REQ_USE_RRM; |
7947 | } | 7949 | } |
7948 | 7950 | ||
@@ -9503,6 +9505,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) | |||
9503 | if (new_triggers.tcp && new_triggers.tcp->sock) | 9505 | if (new_triggers.tcp && new_triggers.tcp->sock) |
9504 | sock_release(new_triggers.tcp->sock); | 9506 | sock_release(new_triggers.tcp->sock); |
9505 | kfree(new_triggers.tcp); | 9507 | kfree(new_triggers.tcp); |
9508 | kfree(new_triggers.nd_config); | ||
9506 | return err; | 9509 | return err; |
9507 | } | 9510 | } |
9508 | #endif | 9511 | #endif |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 2e8d6f39ed56..06d050da0d94 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -3029,6 +3029,7 @@ int set_regdom(const struct ieee80211_regdomain *rd, | |||
3029 | break; | 3029 | break; |
3030 | default: | 3030 | default: |
3031 | WARN(1, "invalid initiator %d\n", lr->initiator); | 3031 | WARN(1, "invalid initiator %d\n", lr->initiator); |
3032 | kfree(rd); | ||
3032 | return -EINVAL; | 3033 | return -EINVAL; |
3033 | } | 3034 | } |
3034 | 3035 | ||
@@ -3221,8 +3222,10 @@ int __init regulatory_init(void) | |||
3221 | /* We always try to get an update for the static regdomain */ | 3222 | /* We always try to get an update for the static regdomain */ |
3222 | err = regulatory_hint_core(cfg80211_world_regdom->alpha2); | 3223 | err = regulatory_hint_core(cfg80211_world_regdom->alpha2); |
3223 | if (err) { | 3224 | if (err) { |
3224 | if (err == -ENOMEM) | 3225 | if (err == -ENOMEM) { |
3226 | platform_device_unregister(reg_pdev); | ||
3225 | return err; | 3227 | return err; |
3228 | } | ||
3226 | /* | 3229 | /* |
3227 | * N.B. kobject_uevent_env() can fail mainly for when we're out | 3230 | * N.B. kobject_uevent_env() can fail mainly for when we're out |
3228 | * memory which is handled and propagated appropriately above | 3231 | * 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)) { |