diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-05-25 22:54:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-05-25 22:54:42 -0400 |
commit | 03250e1028057173b212341015d5fbf53327042c (patch) | |
tree | 1d43ff6bc664227f8ac42ba0a7e897dc51986095 /net | |
parent | 62d18ecfa64137349fac9c5817784fbd48b54f48 (diff) | |
parent | eb110410b9f6477726026669f3f0c0567e8241e6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
"Let's begin the holiday weekend with some networking fixes:
1) Whoops need to restrict cfg80211 wiphy names even more to 64
bytes. From Eric Biggers.
2) Fix flags being ignored when using kernel_connect() with SCTP,
from Xin Long.
3) Use after free in DCCP, from Alexey Kodanev.
4) Need to check rhltable_init() return value in ipmr code, from Eric
Dumazet.
5) XDP handling fixes in virtio_net from Jason Wang.
6) Missing RTA_TABLE in rtm_ipv4_policy[], from Roopa Prabhu.
7) Need to use IRQ disabling spinlocks in mlx4_qp_lookup(), from Jack
Morgenstein.
8) Prevent out-of-bounds speculation using indexes in BPF, from
Daniel Borkmann.
9) Fix regression added by AF_PACKET link layer cure, from Willem de
Bruijn.
10) Correct ENIC dma mask, from Govindarajulu Varadarajan.
11) Missing config options for PMTU tests, from Stefano Brivio"
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (48 commits)
ibmvnic: Fix partial success login retries
selftests/net: Add missing config options for PMTU tests
mlx4_core: allocate ICM memory in page size chunks
enic: set DMA mask to 47 bit
ppp: remove the PPPIOCDETACH ioctl
ipv4: remove warning in ip_recv_error
net : sched: cls_api: deal with egdev path only if needed
vhost: synchronize IOTLB message with dev cleanup
packet: fix reserve calculation
net/mlx5: IPSec, Fix a race between concurrent sandbox QP commands
net/mlx5e: When RXFCS is set, add FCS data into checksum calculation
bpf: properly enforce index mask to prevent out-of-bounds speculation
net/mlx4: Fix irq-unsafe spinlock usage
net: phy: broadcom: Fix bcm_write_exp()
net: phy: broadcom: Fix auxiliary control register reads
net: ipv4: add missing RTA_TABLE to rtm_ipv4_policy
net/mlx4: fix spelling mistake: "Inrerface" -> "Interface" and rephrase message
ibmvnic: Only do H_EOI for mobility events
tuntap: correctly set SOCKWQ_ASYNC_NOSPACE
virtio-net: fix leaking page for gso packet during mergeable XDP
...
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/multicast.c | 2 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 84 | ||||
-rw-r--r-- | net/dccp/proto.c | 2 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 1 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipmr_base.c | 5 | ||||
-rw-r--r-- | net/mac80211/mesh_plink.c | 8 | ||||
-rw-r--r-- | net/packet/af_packet.c | 2 | ||||
-rw-r--r-- | net/sched/cls_api.c | 2 | ||||
-rw-r--r-- | net/sctp/ipv6.c | 2 | ||||
-rw-r--r-- | net/sctp/protocol.c | 2 | ||||
-rw-r--r-- | net/sctp/socket.c | 51 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 3 | ||||
-rw-r--r-- | net/wireless/reg.c | 3 |
14 files changed, 121 insertions, 48 deletions
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index a11d3d89f012..a35f597e8c8b 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c | |||
@@ -1536,7 +1536,7 @@ out: | |||
1536 | 1536 | ||
1537 | if (!ret && primary_if) | 1537 | if (!ret && primary_if) |
1538 | *primary_if = hard_iface; | 1538 | *primary_if = hard_iface; |
1539 | else | 1539 | else if (hard_iface) |
1540 | batadv_hardif_put(hard_iface); | 1540 | batadv_hardif_put(hard_iface); |
1541 | 1541 | ||
1542 | return ret; | 1542 | return ret; |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 0225616d5771..3986551397ca 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -862,7 +862,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, | |||
862 | struct batadv_orig_node_vlan *vlan; | 862 | struct batadv_orig_node_vlan *vlan; |
863 | u8 *tt_change_ptr; | 863 | u8 *tt_change_ptr; |
864 | 864 | ||
865 | rcu_read_lock(); | 865 | spin_lock_bh(&orig_node->vlan_list_lock); |
866 | hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) { | 866 | hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) { |
867 | num_vlan++; | 867 | num_vlan++; |
868 | num_entries += atomic_read(&vlan->tt.num_entries); | 868 | num_entries += atomic_read(&vlan->tt.num_entries); |
@@ -900,7 +900,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node, | |||
900 | *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr; | 900 | *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr; |
901 | 901 | ||
902 | out: | 902 | out: |
903 | rcu_read_unlock(); | 903 | spin_unlock_bh(&orig_node->vlan_list_lock); |
904 | return tvlv_len; | 904 | return tvlv_len; |
905 | } | 905 | } |
906 | 906 | ||
@@ -931,15 +931,20 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, | |||
931 | struct batadv_tvlv_tt_vlan_data *tt_vlan; | 931 | struct batadv_tvlv_tt_vlan_data *tt_vlan; |
932 | struct batadv_softif_vlan *vlan; | 932 | struct batadv_softif_vlan *vlan; |
933 | u16 num_vlan = 0; | 933 | u16 num_vlan = 0; |
934 | u16 num_entries = 0; | 934 | u16 vlan_entries = 0; |
935 | u16 total_entries = 0; | ||
935 | u16 tvlv_len; | 936 | u16 tvlv_len; |
936 | u8 *tt_change_ptr; | 937 | u8 *tt_change_ptr; |
937 | int change_offset; | 938 | int change_offset; |
938 | 939 | ||
939 | rcu_read_lock(); | 940 | spin_lock_bh(&bat_priv->softif_vlan_list_lock); |
940 | hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { | 941 | hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { |
942 | vlan_entries = atomic_read(&vlan->tt.num_entries); | ||
943 | if (vlan_entries < 1) | ||
944 | continue; | ||
945 | |||
941 | num_vlan++; | 946 | num_vlan++; |
942 | num_entries += atomic_read(&vlan->tt.num_entries); | 947 | total_entries += vlan_entries; |
943 | } | 948 | } |
944 | 949 | ||
945 | change_offset = sizeof(**tt_data); | 950 | change_offset = sizeof(**tt_data); |
@@ -947,7 +952,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, | |||
947 | 952 | ||
948 | /* if tt_len is negative, allocate the space needed by the full table */ | 953 | /* if tt_len is negative, allocate the space needed by the full table */ |
949 | if (*tt_len < 0) | 954 | if (*tt_len < 0) |
950 | *tt_len = batadv_tt_len(num_entries); | 955 | *tt_len = batadv_tt_len(total_entries); |
951 | 956 | ||
952 | tvlv_len = *tt_len; | 957 | tvlv_len = *tt_len; |
953 | tvlv_len += change_offset; | 958 | tvlv_len += change_offset; |
@@ -964,6 +969,10 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, | |||
964 | 969 | ||
965 | tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data + 1); | 970 | tt_vlan = (struct batadv_tvlv_tt_vlan_data *)(*tt_data + 1); |
966 | hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { | 971 | hlist_for_each_entry_rcu(vlan, &bat_priv->softif_vlan_list, list) { |
972 | vlan_entries = atomic_read(&vlan->tt.num_entries); | ||
973 | if (vlan_entries < 1) | ||
974 | continue; | ||
975 | |||
967 | tt_vlan->vid = htons(vlan->vid); | 976 | tt_vlan->vid = htons(vlan->vid); |
968 | tt_vlan->crc = htonl(vlan->tt.crc); | 977 | tt_vlan->crc = htonl(vlan->tt.crc); |
969 | 978 | ||
@@ -974,7 +983,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv, | |||
974 | *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr; | 983 | *tt_change = (struct batadv_tvlv_tt_change *)tt_change_ptr; |
975 | 984 | ||
976 | out: | 985 | out: |
977 | rcu_read_unlock(); | 986 | spin_unlock_bh(&bat_priv->softif_vlan_list_lock); |
978 | return tvlv_len; | 987 | return tvlv_len; |
979 | } | 988 | } |
980 | 989 | ||
@@ -1538,6 +1547,8 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry, | |||
1538 | * handled by a given originator | 1547 | * handled by a given originator |
1539 | * @entry: the TT global entry to check | 1548 | * @entry: the TT global entry to check |
1540 | * @orig_node: the originator to search in the list | 1549 | * @orig_node: the originator to search in the list |
1550 | * @flags: a pointer to store TT flags for the given @entry received | ||
1551 | * from @orig_node | ||
1541 | * | 1552 | * |
1542 | * find out if an orig_node is already in the list of a tt_global_entry. | 1553 | * find out if an orig_node is already in the list of a tt_global_entry. |
1543 | * | 1554 | * |
@@ -1545,7 +1556,8 @@ batadv_tt_global_orig_entry_find(const struct batadv_tt_global_entry *entry, | |||
1545 | */ | 1556 | */ |
1546 | static bool | 1557 | static bool |
1547 | batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, | 1558 | batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, |
1548 | const struct batadv_orig_node *orig_node) | 1559 | const struct batadv_orig_node *orig_node, |
1560 | u8 *flags) | ||
1549 | { | 1561 | { |
1550 | struct batadv_tt_orig_list_entry *orig_entry; | 1562 | struct batadv_tt_orig_list_entry *orig_entry; |
1551 | bool found = false; | 1563 | bool found = false; |
@@ -1553,6 +1565,10 @@ batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, | |||
1553 | orig_entry = batadv_tt_global_orig_entry_find(entry, orig_node); | 1565 | orig_entry = batadv_tt_global_orig_entry_find(entry, orig_node); |
1554 | if (orig_entry) { | 1566 | if (orig_entry) { |
1555 | found = true; | 1567 | found = true; |
1568 | |||
1569 | if (flags) | ||
1570 | *flags = orig_entry->flags; | ||
1571 | |||
1556 | batadv_tt_orig_list_entry_put(orig_entry); | 1572 | batadv_tt_orig_list_entry_put(orig_entry); |
1557 | } | 1573 | } |
1558 | 1574 | ||
@@ -1731,7 +1747,7 @@ static bool batadv_tt_global_add(struct batadv_priv *bat_priv, | |||
1731 | if (!(common->flags & BATADV_TT_CLIENT_TEMP)) | 1747 | if (!(common->flags & BATADV_TT_CLIENT_TEMP)) |
1732 | goto out; | 1748 | goto out; |
1733 | if (batadv_tt_global_entry_has_orig(tt_global_entry, | 1749 | if (batadv_tt_global_entry_has_orig(tt_global_entry, |
1734 | orig_node)) | 1750 | orig_node, NULL)) |
1735 | goto out_remove; | 1751 | goto out_remove; |
1736 | batadv_tt_global_del_orig_list(tt_global_entry); | 1752 | batadv_tt_global_del_orig_list(tt_global_entry); |
1737 | goto add_orig_entry; | 1753 | goto add_orig_entry; |
@@ -2880,23 +2896,46 @@ unlock: | |||
2880 | } | 2896 | } |
2881 | 2897 | ||
2882 | /** | 2898 | /** |
2883 | * batadv_tt_local_valid() - verify that given tt entry is a valid one | 2899 | * batadv_tt_local_valid() - verify local tt entry and get flags |
2884 | * @entry_ptr: to be checked local tt entry | 2900 | * @entry_ptr: to be checked local tt entry |
2885 | * @data_ptr: not used but definition required to satisfy the callback prototype | 2901 | * @data_ptr: not used but definition required to satisfy the callback prototype |
2902 | * @flags: a pointer to store TT flags for this client to | ||
2903 | * | ||
2904 | * Checks the validity of the given local TT entry. If it is, then the provided | ||
2905 | * flags pointer is updated. | ||
2886 | * | 2906 | * |
2887 | * Return: true if the entry is a valid, false otherwise. | 2907 | * Return: true if the entry is a valid, false otherwise. |
2888 | */ | 2908 | */ |
2889 | static bool batadv_tt_local_valid(const void *entry_ptr, const void *data_ptr) | 2909 | static bool batadv_tt_local_valid(const void *entry_ptr, |
2910 | const void *data_ptr, | ||
2911 | u8 *flags) | ||
2890 | { | 2912 | { |
2891 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; | 2913 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; |
2892 | 2914 | ||
2893 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) | 2915 | if (tt_common_entry->flags & BATADV_TT_CLIENT_NEW) |
2894 | return false; | 2916 | return false; |
2917 | |||
2918 | if (flags) | ||
2919 | *flags = tt_common_entry->flags; | ||
2920 | |||
2895 | return true; | 2921 | return true; |
2896 | } | 2922 | } |
2897 | 2923 | ||
2924 | /** | ||
2925 | * batadv_tt_global_valid() - verify global tt entry and get flags | ||
2926 | * @entry_ptr: to be checked global tt entry | ||
2927 | * @data_ptr: an orig_node object (may be NULL) | ||
2928 | * @flags: a pointer to store TT flags for this client to | ||
2929 | * | ||
2930 | * Checks the validity of the given global TT entry. If it is, then the provided | ||
2931 | * flags pointer is updated either with the common (summed) TT flags if data_ptr | ||
2932 | * is NULL or the specific, per originator TT flags otherwise. | ||
2933 | * | ||
2934 | * Return: true if the entry is a valid, false otherwise. | ||
2935 | */ | ||
2898 | static bool batadv_tt_global_valid(const void *entry_ptr, | 2936 | static bool batadv_tt_global_valid(const void *entry_ptr, |
2899 | const void *data_ptr) | 2937 | const void *data_ptr, |
2938 | u8 *flags) | ||
2900 | { | 2939 | { |
2901 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; | 2940 | const struct batadv_tt_common_entry *tt_common_entry = entry_ptr; |
2902 | const struct batadv_tt_global_entry *tt_global_entry; | 2941 | const struct batadv_tt_global_entry *tt_global_entry; |
@@ -2910,7 +2949,8 @@ static bool batadv_tt_global_valid(const void *entry_ptr, | |||
2910 | struct batadv_tt_global_entry, | 2949 | struct batadv_tt_global_entry, |
2911 | common); | 2950 | common); |
2912 | 2951 | ||
2913 | return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node); | 2952 | return batadv_tt_global_entry_has_orig(tt_global_entry, orig_node, |
2953 | flags); | ||
2914 | } | 2954 | } |
2915 | 2955 | ||
2916 | /** | 2956 | /** |
@@ -2920,25 +2960,34 @@ static bool batadv_tt_global_valid(const void *entry_ptr, | |||
2920 | * @hash: hash table containing the tt entries | 2960 | * @hash: hash table containing the tt entries |
2921 | * @tt_len: expected tvlv tt data buffer length in number of bytes | 2961 | * @tt_len: expected tvlv tt data buffer length in number of bytes |
2922 | * @tvlv_buff: pointer to the buffer to fill with the TT data | 2962 | * @tvlv_buff: pointer to the buffer to fill with the TT data |
2923 | * @valid_cb: function to filter tt change entries | 2963 | * @valid_cb: function to filter tt change entries and to return TT flags |
2924 | * @cb_data: data passed to the filter function as argument | 2964 | * @cb_data: data passed to the filter function as argument |
2965 | * | ||
2966 | * Fills the tvlv buff with the tt entries from the specified hash. If valid_cb | ||
2967 | * is not provided then this becomes a no-op. | ||
2925 | */ | 2968 | */ |
2926 | static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, | 2969 | static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, |
2927 | struct batadv_hashtable *hash, | 2970 | struct batadv_hashtable *hash, |
2928 | void *tvlv_buff, u16 tt_len, | 2971 | void *tvlv_buff, u16 tt_len, |
2929 | bool (*valid_cb)(const void *, | 2972 | bool (*valid_cb)(const void *, |
2930 | const void *), | 2973 | const void *, |
2974 | u8 *flags), | ||
2931 | void *cb_data) | 2975 | void *cb_data) |
2932 | { | 2976 | { |
2933 | struct batadv_tt_common_entry *tt_common_entry; | 2977 | struct batadv_tt_common_entry *tt_common_entry; |
2934 | struct batadv_tvlv_tt_change *tt_change; | 2978 | struct batadv_tvlv_tt_change *tt_change; |
2935 | struct hlist_head *head; | 2979 | struct hlist_head *head; |
2936 | u16 tt_tot, tt_num_entries = 0; | 2980 | u16 tt_tot, tt_num_entries = 0; |
2981 | u8 flags; | ||
2982 | bool ret; | ||
2937 | u32 i; | 2983 | u32 i; |
2938 | 2984 | ||
2939 | tt_tot = batadv_tt_entries(tt_len); | 2985 | tt_tot = batadv_tt_entries(tt_len); |
2940 | tt_change = (struct batadv_tvlv_tt_change *)tvlv_buff; | 2986 | tt_change = (struct batadv_tvlv_tt_change *)tvlv_buff; |
2941 | 2987 | ||
2988 | if (!valid_cb) | ||
2989 | return; | ||
2990 | |||
2942 | rcu_read_lock(); | 2991 | rcu_read_lock(); |
2943 | for (i = 0; i < hash->size; i++) { | 2992 | for (i = 0; i < hash->size; i++) { |
2944 | head = &hash->table[i]; | 2993 | head = &hash->table[i]; |
@@ -2948,11 +2997,12 @@ static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv, | |||
2948 | if (tt_tot == tt_num_entries) | 2997 | if (tt_tot == tt_num_entries) |
2949 | break; | 2998 | break; |
2950 | 2999 | ||
2951 | if ((valid_cb) && (!valid_cb(tt_common_entry, cb_data))) | 3000 | ret = valid_cb(tt_common_entry, cb_data, &flags); |
3001 | if (!ret) | ||
2952 | continue; | 3002 | continue; |
2953 | 3003 | ||
2954 | ether_addr_copy(tt_change->addr, tt_common_entry->addr); | 3004 | ether_addr_copy(tt_change->addr, tt_common_entry->addr); |
2955 | tt_change->flags = tt_common_entry->flags; | 3005 | tt_change->flags = flags; |
2956 | tt_change->vid = htons(tt_common_entry->vid); | 3006 | tt_change->vid = htons(tt_common_entry->vid); |
2957 | memset(tt_change->reserved, 0, | 3007 | memset(tt_change->reserved, 0, |
2958 | sizeof(tt_change->reserved)); | 3008 | sizeof(tt_change->reserved)); |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 84cd4e3fd01b..0d56e36a6db7 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -283,9 +283,7 @@ int dccp_disconnect(struct sock *sk, int flags) | |||
283 | 283 | ||
284 | dccp_clear_xmit_timers(sk); | 284 | dccp_clear_xmit_timers(sk); |
285 | ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); | 285 | ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk); |
286 | ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk); | ||
287 | dp->dccps_hc_rx_ccid = NULL; | 286 | dp->dccps_hc_rx_ccid = NULL; |
288 | dp->dccps_hc_tx_ccid = NULL; | ||
289 | 287 | ||
290 | __skb_queue_purge(&sk->sk_receive_queue); | 288 | __skb_queue_purge(&sk->sk_receive_queue); |
291 | __skb_queue_purge(&sk->sk_write_queue); | 289 | __skb_queue_purge(&sk->sk_write_queue); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 4d622112bf95..e66172aaf241 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -649,6 +649,7 @@ const struct nla_policy rtm_ipv4_policy[RTA_MAX + 1] = { | |||
649 | [RTA_ENCAP] = { .type = NLA_NESTED }, | 649 | [RTA_ENCAP] = { .type = NLA_NESTED }, |
650 | [RTA_UID] = { .type = NLA_U32 }, | 650 | [RTA_UID] = { .type = NLA_U32 }, |
651 | [RTA_MARK] = { .type = NLA_U32 }, | 651 | [RTA_MARK] = { .type = NLA_U32 }, |
652 | [RTA_TABLE] = { .type = NLA_U32 }, | ||
652 | }; | 653 | }; |
653 | 654 | ||
654 | static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, | 655 | static int rtm_to_fib_config(struct net *net, struct sk_buff *skb, |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 5ad2d8ed3a3f..57bbb060faaf 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -505,8 +505,6 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, int len, int *addr_len) | |||
505 | int err; | 505 | int err; |
506 | int copied; | 506 | int copied; |
507 | 507 | ||
508 | WARN_ON_ONCE(sk->sk_family == AF_INET6); | ||
509 | |||
510 | err = -EAGAIN; | 508 | err = -EAGAIN; |
511 | skb = sock_dequeue_err_skb(sk); | 509 | skb = sock_dequeue_err_skb(sk); |
512 | if (!skb) | 510 | if (!skb) |
diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c index 4fe97723b53f..30221701614c 100644 --- a/net/ipv4/ipmr_base.c +++ b/net/ipv4/ipmr_base.c | |||
@@ -43,7 +43,10 @@ mr_table_alloc(struct net *net, u32 id, | |||
43 | write_pnet(&mrt->net, net); | 43 | write_pnet(&mrt->net, net); |
44 | 44 | ||
45 | mrt->ops = *ops; | 45 | mrt->ops = *ops; |
46 | rhltable_init(&mrt->mfc_hash, mrt->ops.rht_params); | 46 | if (rhltable_init(&mrt->mfc_hash, mrt->ops.rht_params)) { |
47 | kfree(mrt); | ||
48 | return NULL; | ||
49 | } | ||
47 | INIT_LIST_HEAD(&mrt->mfc_cache_list); | 50 | INIT_LIST_HEAD(&mrt->mfc_cache_list); |
48 | INIT_LIST_HEAD(&mrt->mfc_unres_queue); | 51 | INIT_LIST_HEAD(&mrt->mfc_unres_queue); |
49 | 52 | ||
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 0f6c9ca59062..5b5b0f95ffd1 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -401,7 +401,7 @@ u32 mesh_plink_deactivate(struct sta_info *sta) | |||
401 | 401 | ||
402 | static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, | 402 | static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, |
403 | struct sta_info *sta, | 403 | struct sta_info *sta, |
404 | struct ieee802_11_elems *elems, bool insert) | 404 | struct ieee802_11_elems *elems) |
405 | { | 405 | { |
406 | struct ieee80211_local *local = sdata->local; | 406 | struct ieee80211_local *local = sdata->local; |
407 | struct ieee80211_supported_band *sband; | 407 | struct ieee80211_supported_band *sband; |
@@ -447,7 +447,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, | |||
447 | sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; | 447 | sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; |
448 | } | 448 | } |
449 | 449 | ||
450 | if (insert) | 450 | if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) |
451 | rate_control_rate_init(sta); | 451 | rate_control_rate_init(sta); |
452 | else | 452 | else |
453 | rate_control_rate_update(local, sband, sta, changed); | 453 | rate_control_rate_update(local, sband, sta, changed); |
@@ -551,7 +551,7 @@ mesh_sta_info_get(struct ieee80211_sub_if_data *sdata, | |||
551 | rcu_read_lock(); | 551 | rcu_read_lock(); |
552 | sta = sta_info_get(sdata, addr); | 552 | sta = sta_info_get(sdata, addr); |
553 | if (sta) { | 553 | if (sta) { |
554 | mesh_sta_info_init(sdata, sta, elems, false); | 554 | mesh_sta_info_init(sdata, sta, elems); |
555 | } else { | 555 | } else { |
556 | rcu_read_unlock(); | 556 | rcu_read_unlock(); |
557 | /* can't run atomic */ | 557 | /* can't run atomic */ |
@@ -561,7 +561,7 @@ mesh_sta_info_get(struct ieee80211_sub_if_data *sdata, | |||
561 | return NULL; | 561 | return NULL; |
562 | } | 562 | } |
563 | 563 | ||
564 | mesh_sta_info_init(sdata, sta, elems, true); | 564 | mesh_sta_info_init(sdata, sta, elems); |
565 | 565 | ||
566 | if (sta_info_insert_rcu(sta)) | 566 | if (sta_info_insert_rcu(sta)) |
567 | return NULL; | 567 | return NULL; |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index e9422fe45179..acb7b86574cd 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2911,7 +2911,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) | |||
2911 | if (unlikely(offset < 0)) | 2911 | if (unlikely(offset < 0)) |
2912 | goto out_free; | 2912 | goto out_free; |
2913 | } else if (reserve) { | 2913 | } else if (reserve) { |
2914 | skb_push(skb, reserve); | 2914 | skb_reserve(skb, -reserve); |
2915 | } | 2915 | } |
2916 | 2916 | ||
2917 | /* Returns -EFAULT on error */ | 2917 | /* Returns -EFAULT on error */ |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 963e4bf0aab8..a57e112d9b3e 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -1588,7 +1588,7 @@ int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts, | |||
1588 | return ret; | 1588 | return ret; |
1589 | ok_count = ret; | 1589 | ok_count = ret; |
1590 | 1590 | ||
1591 | if (!exts) | 1591 | if (!exts || ok_count) |
1592 | return ok_count; | 1592 | return ok_count; |
1593 | ret = tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop); | 1593 | ret = tc_exts_setup_cb_egdev_call(exts, type, type_data, err_stop); |
1594 | if (ret < 0) | 1594 | if (ret < 0) |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 42247110d842..0cd2e764f47f 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -1006,7 +1006,7 @@ static const struct proto_ops inet6_seqpacket_ops = { | |||
1006 | .owner = THIS_MODULE, | 1006 | .owner = THIS_MODULE, |
1007 | .release = inet6_release, | 1007 | .release = inet6_release, |
1008 | .bind = inet6_bind, | 1008 | .bind = inet6_bind, |
1009 | .connect = inet_dgram_connect, | 1009 | .connect = sctp_inet_connect, |
1010 | .socketpair = sock_no_socketpair, | 1010 | .socketpair = sock_no_socketpair, |
1011 | .accept = inet_accept, | 1011 | .accept = inet_accept, |
1012 | .getname = sctp_getname, | 1012 | .getname = sctp_getname, |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index d685f8456762..6bf0a9971888 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -1012,7 +1012,7 @@ static const struct proto_ops inet_seqpacket_ops = { | |||
1012 | .owner = THIS_MODULE, | 1012 | .owner = THIS_MODULE, |
1013 | .release = inet_release, /* Needs to be wrapped... */ | 1013 | .release = inet_release, /* Needs to be wrapped... */ |
1014 | .bind = inet_bind, | 1014 | .bind = inet_bind, |
1015 | .connect = inet_dgram_connect, | 1015 | .connect = sctp_inet_connect, |
1016 | .socketpair = sock_no_socketpair, | 1016 | .socketpair = sock_no_socketpair, |
1017 | .accept = inet_accept, | 1017 | .accept = inet_accept, |
1018 | .getname = inet_getname, /* Semantics are different. */ | 1018 | .getname = inet_getname, /* Semantics are different. */ |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 80835ac26d2c..ae7e7c606f72 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1086,7 +1086,7 @@ out: | |||
1086 | */ | 1086 | */ |
1087 | static int __sctp_connect(struct sock *sk, | 1087 | static int __sctp_connect(struct sock *sk, |
1088 | struct sockaddr *kaddrs, | 1088 | struct sockaddr *kaddrs, |
1089 | int addrs_size, | 1089 | int addrs_size, int flags, |
1090 | sctp_assoc_t *assoc_id) | 1090 | sctp_assoc_t *assoc_id) |
1091 | { | 1091 | { |
1092 | struct net *net = sock_net(sk); | 1092 | struct net *net = sock_net(sk); |
@@ -1104,7 +1104,6 @@ static int __sctp_connect(struct sock *sk, | |||
1104 | union sctp_addr *sa_addr = NULL; | 1104 | union sctp_addr *sa_addr = NULL; |
1105 | void *addr_buf; | 1105 | void *addr_buf; |
1106 | unsigned short port; | 1106 | unsigned short port; |
1107 | unsigned int f_flags = 0; | ||
1108 | 1107 | ||
1109 | sp = sctp_sk(sk); | 1108 | sp = sctp_sk(sk); |
1110 | ep = sp->ep; | 1109 | ep = sp->ep; |
@@ -1254,13 +1253,7 @@ static int __sctp_connect(struct sock *sk, | |||
1254 | sp->pf->to_sk_daddr(sa_addr, sk); | 1253 | sp->pf->to_sk_daddr(sa_addr, sk); |
1255 | sk->sk_err = 0; | 1254 | sk->sk_err = 0; |
1256 | 1255 | ||
1257 | /* in-kernel sockets don't generally have a file allocated to them | 1256 | timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); |
1258 | * if all they do is call sock_create_kern(). | ||
1259 | */ | ||
1260 | if (sk->sk_socket->file) | ||
1261 | f_flags = sk->sk_socket->file->f_flags; | ||
1262 | |||
1263 | timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK); | ||
1264 | 1257 | ||
1265 | if (assoc_id) | 1258 | if (assoc_id) |
1266 | *assoc_id = asoc->assoc_id; | 1259 | *assoc_id = asoc->assoc_id; |
@@ -1348,7 +1341,7 @@ static int __sctp_setsockopt_connectx(struct sock *sk, | |||
1348 | sctp_assoc_t *assoc_id) | 1341 | sctp_assoc_t *assoc_id) |
1349 | { | 1342 | { |
1350 | struct sockaddr *kaddrs; | 1343 | struct sockaddr *kaddrs; |
1351 | int err = 0; | 1344 | int err = 0, flags = 0; |
1352 | 1345 | ||
1353 | pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", | 1346 | pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", |
1354 | __func__, sk, addrs, addrs_size); | 1347 | __func__, sk, addrs, addrs_size); |
@@ -1367,7 +1360,13 @@ static int __sctp_setsockopt_connectx(struct sock *sk, | |||
1367 | if (err) | 1360 | if (err) |
1368 | goto out_free; | 1361 | goto out_free; |
1369 | 1362 | ||
1370 | err = __sctp_connect(sk, kaddrs, addrs_size, assoc_id); | 1363 | /* in-kernel sockets don't generally have a file allocated to them |
1364 | * if all they do is call sock_create_kern(). | ||
1365 | */ | ||
1366 | if (sk->sk_socket->file) | ||
1367 | flags = sk->sk_socket->file->f_flags; | ||
1368 | |||
1369 | err = __sctp_connect(sk, kaddrs, addrs_size, flags, assoc_id); | ||
1371 | 1370 | ||
1372 | out_free: | 1371 | out_free: |
1373 | kvfree(kaddrs); | 1372 | kvfree(kaddrs); |
@@ -4397,16 +4396,26 @@ out_nounlock: | |||
4397 | * len: the size of the address. | 4396 | * len: the size of the address. |
4398 | */ | 4397 | */ |
4399 | static int sctp_connect(struct sock *sk, struct sockaddr *addr, | 4398 | static int sctp_connect(struct sock *sk, struct sockaddr *addr, |
4400 | int addr_len) | 4399 | int addr_len, int flags) |
4401 | { | 4400 | { |
4402 | int err = 0; | 4401 | struct inet_sock *inet = inet_sk(sk); |
4403 | struct sctp_af *af; | 4402 | struct sctp_af *af; |
4403 | int err = 0; | ||
4404 | 4404 | ||
4405 | lock_sock(sk); | 4405 | lock_sock(sk); |
4406 | 4406 | ||
4407 | pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, | 4407 | pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, |
4408 | addr, addr_len); | 4408 | addr, addr_len); |
4409 | 4409 | ||
4410 | /* We may need to bind the socket. */ | ||
4411 | if (!inet->inet_num) { | ||
4412 | if (sk->sk_prot->get_port(sk, 0)) { | ||
4413 | release_sock(sk); | ||
4414 | return -EAGAIN; | ||
4415 | } | ||
4416 | inet->inet_sport = htons(inet->inet_num); | ||
4417 | } | ||
4418 | |||
4410 | /* Validate addr_len before calling common connect/connectx routine. */ | 4419 | /* Validate addr_len before calling common connect/connectx routine. */ |
4411 | af = sctp_get_af_specific(addr->sa_family); | 4420 | af = sctp_get_af_specific(addr->sa_family); |
4412 | if (!af || addr_len < af->sockaddr_len) { | 4421 | if (!af || addr_len < af->sockaddr_len) { |
@@ -4415,13 +4424,25 @@ static int sctp_connect(struct sock *sk, struct sockaddr *addr, | |||
4415 | /* Pass correct addr len to common routine (so it knows there | 4424 | /* Pass correct addr len to common routine (so it knows there |
4416 | * is only one address being passed. | 4425 | * is only one address being passed. |
4417 | */ | 4426 | */ |
4418 | err = __sctp_connect(sk, addr, af->sockaddr_len, NULL); | 4427 | err = __sctp_connect(sk, addr, af->sockaddr_len, flags, NULL); |
4419 | } | 4428 | } |
4420 | 4429 | ||
4421 | release_sock(sk); | 4430 | release_sock(sk); |
4422 | return err; | 4431 | return err; |
4423 | } | 4432 | } |
4424 | 4433 | ||
4434 | int sctp_inet_connect(struct socket *sock, struct sockaddr *uaddr, | ||
4435 | int addr_len, int flags) | ||
4436 | { | ||
4437 | if (addr_len < sizeof(uaddr->sa_family)) | ||
4438 | return -EINVAL; | ||
4439 | |||
4440 | if (uaddr->sa_family == AF_UNSPEC) | ||
4441 | return -EOPNOTSUPP; | ||
4442 | |||
4443 | return sctp_connect(sock->sk, uaddr, addr_len, flags); | ||
4444 | } | ||
4445 | |||
4425 | /* FIXME: Write comments. */ | 4446 | /* FIXME: Write comments. */ |
4426 | static int sctp_disconnect(struct sock *sk, int flags) | 4447 | static int sctp_disconnect(struct sock *sk, int flags) |
4427 | { | 4448 | { |
@@ -8724,7 +8745,6 @@ struct proto sctp_prot = { | |||
8724 | .name = "SCTP", | 8745 | .name = "SCTP", |
8725 | .owner = THIS_MODULE, | 8746 | .owner = THIS_MODULE, |
8726 | .close = sctp_close, | 8747 | .close = sctp_close, |
8727 | .connect = sctp_connect, | ||
8728 | .disconnect = sctp_disconnect, | 8748 | .disconnect = sctp_disconnect, |
8729 | .accept = sctp_accept, | 8749 | .accept = sctp_accept, |
8730 | .ioctl = sctp_ioctl, | 8750 | .ioctl = sctp_ioctl, |
@@ -8767,7 +8787,6 @@ struct proto sctpv6_prot = { | |||
8767 | .name = "SCTPv6", | 8787 | .name = "SCTPv6", |
8768 | .owner = THIS_MODULE, | 8788 | .owner = THIS_MODULE, |
8769 | .close = sctp_close, | 8789 | .close = sctp_close, |
8770 | .connect = sctp_connect, | ||
8771 | .disconnect = sctp_disconnect, | 8790 | .disconnect = sctp_disconnect, |
8772 | .accept = sctp_accept, | 8791 | .accept = sctp_accept, |
8773 | .ioctl = sctp_ioctl, | 8792 | .ioctl = sctp_ioctl, |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a052693c2e85..7c5135a92d76 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -15555,7 +15555,8 @@ void cfg80211_ft_event(struct net_device *netdev, | |||
15555 | if (!ft_event->target_ap) | 15555 | if (!ft_event->target_ap) |
15556 | return; | 15556 | return; |
15557 | 15557 | ||
15558 | msg = nlmsg_new(100 + ft_event->ric_ies_len, GFP_KERNEL); | 15558 | msg = nlmsg_new(100 + ft_event->ies_len + ft_event->ric_ies_len, |
15559 | GFP_KERNEL); | ||
15559 | if (!msg) | 15560 | if (!msg) |
15560 | return; | 15561 | return; |
15561 | 15562 | ||
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index ac3e12c32aa3..5fcec5c94eb7 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -916,6 +916,9 @@ int reg_query_regdb_wmm(char *alpha2, int freq, u32 *dbptr, | |||
916 | const struct fwdb_header *hdr = regdb; | 916 | const struct fwdb_header *hdr = regdb; |
917 | const struct fwdb_country *country; | 917 | const struct fwdb_country *country; |
918 | 918 | ||
919 | if (!regdb) | ||
920 | return -ENODATA; | ||
921 | |||
919 | if (IS_ERR(regdb)) | 922 | if (IS_ERR(regdb)) |
920 | return PTR_ERR(regdb); | 923 | return PTR_ERR(regdb); |
921 | 924 | ||