Skip to content

Commit 5fa6a68

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "It looks like a sizeble collection but this is nearly 3 weeks of bug fixing while you were away. 1) Fix crashes over IPSEC tunnels with NAT, the latter can reroute the packet through a non-IPSEC protected path and the code has to be able to handle SKBs attached to routes lacking an attached xfrm state. From Steffen Klassert. 2) Fix OOPSs in ipv4 and ipv6 ipsec layers for unsupported sub-protocols, also from Steffen Klassert. 3) Set local_df on fragmented netfilter skbs otherwise we won't be able to forward successfully, from Florian Westphal. 4) cdc_mbim ipv6 neighbour code does __vlan_find_dev_deep without holding RCU lock, from Bjorn Mork. 5) local_df test in ip_may_fragment is inverted, from Florian Westphal. 6) jme driver doesn't check for DMA mapping failures, from Neil Horman. 7) qlogic driver doesn't calculate number of TX queues properly, from Shahed Shaikh. 8) fib_info_cnt can drift irreversibly positive if we fail to allocate the fi->fib_metrics array, from Sergey Popovich. 9) Fix use after free in ip6_route_me_harder(), also from Sergey Popovich. 10) When SYSCTL is disabled, we don't handle local_port_range and ping_group_range defaults properly at all, from Cong Wang. 11) Unaccelerated VLAN tagged frames improperly handled by cdc_mbim driver, fix from Bjorn Mork. 12) cassini driver needs nested lock annotations for TX locking, from Emil Goode. 13) On init error ipv6 VTI driver can unregister pernet ops twice, oops. Fix from Mahtias Krause. 14) If macvlan device is down, don't propagate IFF_ALLMULTI changes, from Peter Christensen. 15) Missing NULL pointer check while parsing netlink config options in ip6_tnl_validate(). From Susant Sahani. 16) Fix handling of neighbour entries during ipv6 router reachability probing, from Duan Jiong. 17) x86 and s390 JIT address randomization has some address calculation bugs leading to crashes, from Alexei Starovoitov and Heiko Carstens. 18) Clear up those uglies with nop patching and net_get_random_once(), from Hannes Frederic Sowa. 19) Option length miscalculated in ip6_append_data(), fix also from Hannes Frederic Sowa. 20) A while ago we fixed a race during device unregistry when a namespace went down, turns out there is a second place that needs similar protection. From Cong Wang. 21) In the new Altera TSE driver multicast filtering isn't working, disable it and just use promisc mode until the cause is found. From Vince Bridgers. 22) When we disable router enabling in ipv6 we have to flush the cached routes explicitly, from Duan Jiong. 23) NBMA tunnels should not cache routes on the tunnel object because the key is variable, from Timo Teräs. 24) With stacked devices GRO information in skb->cb[] can be not setup properly, make sure it is in all code paths. From Eric Dumazet. 25) Really fix stacked vlan locking, multiple levels of nesting with intervening non-vlan devices are possible. From Vlad Yasevich. 26) Fallback ipip tunnel device's mtu is not setup properly, from Steffen Klassert. 27) The packet scheduler's tcindex filter can crash because we structure copy objects with list_head's inside, oops. From Cong Wang. 28) Fix CHECKSUM_COMPLETE handling for ipv6 GRE tunnels, from Eric Dumazet. 29) In some configurations 'itag' in __mkroute_input() can end up being used uninitialized because of how fib_validate_source() works. Fix it by explitly initializing itag to zero like all the other fib_validate_source() callers do, from Li RongQing" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (116 commits) batman: fix a bogus warning from batadv_is_on_batman_iface() ipv4: initialise the itag variable in __mkroute_input bonding: Send ALB learning packets using the right source bonding: Don't assume 802.1Q when sending alb learning packets. net: doc: Update references to skb->rxhash stmmac: Remove unbalanced clk_disable call ipv6: gro: fix CHECKSUM_COMPLETE support net_sched: fix an oops in tcindex filter can: peak_pci: prevent use after free at netdev removal ip_tunnel: Initialize the fallback device properly vlan: Fix build error wth vlan_get_encap_level() can: c_can: remove obsolete STRICT_FRAME_ORDERING Kconfig option MAINTAINERS: Pravin Shelar is Open vSwitch maintainer. bnx2x: Convert return 0 to return rc bonding: Fix alb mode to only use first level vlans. bonding: Fix stacked device detection in arp monitoring macvlan: Fix lockdep warnings with stacked macvlan devices vlan: Fix lockdep warning with stacked vlan devices. net: Allow for more then a single subclass for netif_addr_lock net: Find the nesting level of a given device by type. ...
2 parents f02f79d + b6ed549 commit 5fa6a68

131 files changed

Lines changed: 2381 additions & 928 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/devicetree/bindings/net/mdio-gpio.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ node.
1414
Example:
1515

1616
aliases {
17-
mdio-gpio0 = <&mdio0>;
17+
mdio-gpio0 = &mdio0;
1818
};
1919

2020
mdio0: mdio {

‎Documentation/networking/filter.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Possible BPF extensions are shown in the following table:
277277
mark skb->mark
278278
queue skb->queue_mapping
279279
hatype skb->dev->type
280-
rxhash skb->rxhash
280+
rxhash skb->hash
281281
cpu raw_smp_processor_id()
282282
vlan_tci vlan_tx_tag_get(skb)
283283
vlan_pr vlan_tx_tag_present(skb)

‎Documentation/networking/packet_mmap.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ processes. This also works in combination with mmap(2) on packet sockets.
578578

579579
Currently implemented fanout policies are:
580580

581-
- PACKET_FANOUT_HASH: schedule to socket by skb's rxhash
581+
- PACKET_FANOUT_HASH: schedule to socket by skb's packet hash
582582
- PACKET_FANOUT_LB: schedule to socket by round-robin
583583
- PACKET_FANOUT_CPU: schedule to socket by CPU packet arrives on
584584
- PACKET_FANOUT_RND: schedule to socket by random selection

‎MAINTAINERS‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6514,10 +6514,10 @@ T: git git://openrisc.net/~jonas/linux
65146514
F: arch/openrisc/
65156515

65166516
OPENVSWITCH
6517-
M: Jesse Gross <jesse@nicira.com>
6517+
M: Pravin Shelar <pshelar@nicira.com>
65186518
L: dev@openvswitch.org
65196519
W: http://openvswitch.org
6520-
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git
6520+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pshelar/openvswitch.git
65216521
S: Maintained
65226522
F: net/openvswitch/
65236523

‎arch/s390/net/bpf_jit_comp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize,
811811
return NULL;
812812
memset(header, 0, sz);
813813
header->pages = sz / PAGE_SIZE;
814-
hole = sz - (bpfsize + sizeof(*header));
814+
hole = min(sz - (bpfsize + sizeof(*header)), PAGE_SIZE - sizeof(*header));
815815
/* Insert random number of illegal instructions before BPF code
816816
* and make sure the first instruction starts at an even address.
817817
*/

‎arch/x86/net/bpf_jit_comp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
171171
memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
172172

173173
header->pages = sz / PAGE_SIZE;
174-
hole = sz - (proglen + sizeof(*header));
174+
hole = min(sz - (proglen + sizeof(*header)), PAGE_SIZE - sizeof(*header));
175175

176176
/* insert a random number of int3 instructions before BPF code */
177177
*image_ptr = &header->image[prandom_u32() % hole];

‎drivers/infiniband/hw/mlx4/main.c‎

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
#include <linux/mlx4/driver.h>
5050
#include <linux/mlx4/cmd.h>
51+
#include <linux/mlx4/qp.h>
5152

5253
#include "mlx4_ib.h"
5354
#include "user.h"
@@ -1614,6 +1615,53 @@ static int mlx4_ib_inet6_event(struct notifier_block *this, unsigned long event,
16141615
}
16151616
#endif
16161617

1618+
#define MLX4_IB_INVALID_MAC ((u64)-1)
1619+
static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev,
1620+
struct net_device *dev,
1621+
int port)
1622+
{
1623+
u64 new_smac = 0;
1624+
u64 release_mac = MLX4_IB_INVALID_MAC;
1625+
struct mlx4_ib_qp *qp;
1626+
1627+
read_lock(&dev_base_lock);
1628+
new_smac = mlx4_mac_to_u64(dev->dev_addr);
1629+
read_unlock(&dev_base_lock);
1630+
1631+
mutex_lock(&ibdev->qp1_proxy_lock[port - 1]);
1632+
qp = ibdev->qp1_proxy[port - 1];
1633+
if (qp) {
1634+
int new_smac_index;
1635+
u64 old_smac = qp->pri.smac;
1636+
struct mlx4_update_qp_params update_params;
1637+
1638+
if (new_smac == old_smac)
1639+
goto unlock;
1640+
1641+
new_smac_index = mlx4_register_mac(ibdev->dev, port, new_smac);
1642+
1643+
if (new_smac_index < 0)
1644+
goto unlock;
1645+
1646+
update_params.smac_index = new_smac_index;
1647+
if (mlx4_update_qp(ibdev->dev, &qp->mqp, MLX4_UPDATE_QP_SMAC,
1648+
&update_params)) {
1649+
release_mac = new_smac;
1650+
goto unlock;
1651+
}
1652+
1653+
qp->pri.smac = new_smac;
1654+
qp->pri.smac_index = new_smac_index;
1655+
1656+
release_mac = old_smac;
1657+
}
1658+
1659+
unlock:
1660+
mutex_unlock(&ibdev->qp1_proxy_lock[port - 1]);
1661+
if (release_mac != MLX4_IB_INVALID_MAC)
1662+
mlx4_unregister_mac(ibdev->dev, port, release_mac);
1663+
}
1664+
16171665
static void mlx4_ib_get_dev_addr(struct net_device *dev,
16181666
struct mlx4_ib_dev *ibdev, u8 port)
16191667
{
@@ -1689,9 +1737,13 @@ static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
16891737
return 0;
16901738
}
16911739

1692-
static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev)
1740+
static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev,
1741+
struct net_device *dev,
1742+
unsigned long event)
1743+
16931744
{
16941745
struct mlx4_ib_iboe *iboe;
1746+
int update_qps_port = -1;
16951747
int port;
16961748

16971749
iboe = &ibdev->iboe;
@@ -1719,6 +1771,11 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev)
17191771
}
17201772
curr_master = iboe->masters[port - 1];
17211773

1774+
if (dev == iboe->netdevs[port - 1] &&
1775+
(event == NETDEV_CHANGEADDR || event == NETDEV_REGISTER ||
1776+
event == NETDEV_UP || event == NETDEV_CHANGE))
1777+
update_qps_port = port;
1778+
17221779
if (curr_netdev) {
17231780
port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ?
17241781
IB_PORT_ACTIVE : IB_PORT_DOWN;
@@ -1752,6 +1809,9 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev)
17521809
}
17531810

17541811
spin_unlock(&iboe->lock);
1812+
1813+
if (update_qps_port > 0)
1814+
mlx4_ib_update_qps(ibdev, dev, update_qps_port);
17551815
}
17561816

17571817
static int mlx4_ib_netdev_event(struct notifier_block *this,
@@ -1764,7 +1824,7 @@ static int mlx4_ib_netdev_event(struct notifier_block *this,
17641824
return NOTIFY_DONE;
17651825

17661826
ibdev = container_of(this, struct mlx4_ib_dev, iboe.nb);
1767-
mlx4_ib_scan_netdevs(ibdev);
1827+
mlx4_ib_scan_netdevs(ibdev, dev, event);
17681828

17691829
return NOTIFY_DONE;
17701830
}
@@ -2043,6 +2103,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
20432103
goto err_map;
20442104

20452105
for (i = 0; i < ibdev->num_ports; ++i) {
2106+
mutex_init(&ibdev->qp1_proxy_lock[i]);
20462107
if (mlx4_ib_port_link_layer(&ibdev->ib_dev, i + 1) ==
20472108
IB_LINK_LAYER_ETHERNET) {
20482109
err = mlx4_counter_alloc(ibdev->dev, &ibdev->counters[i]);
@@ -2126,7 +2187,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
21262187
for (i = 1 ; i <= ibdev->num_ports ; ++i)
21272188
reset_gid_table(ibdev, i);
21282189
rtnl_lock();
2129-
mlx4_ib_scan_netdevs(ibdev);
2190+
mlx4_ib_scan_netdevs(ibdev, NULL, 0);
21302191
rtnl_unlock();
21312192
mlx4_ib_init_gid_table(ibdev);
21322193
}

‎drivers/infiniband/hw/mlx4/mlx4_ib.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@ struct mlx4_ib_dev {
522522
int steer_qpn_count;
523523
int steer_qpn_base;
524524
int steering_support;
525+
struct mlx4_ib_qp *qp1_proxy[MLX4_MAX_PORTS];
526+
/* lock when destroying qp1_proxy and getting netdev events */
527+
struct mutex qp1_proxy_lock[MLX4_MAX_PORTS];
525528
};
526529

527530
struct ib_event_work {

‎drivers/infiniband/hw/mlx4/qp.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,12 @@ int mlx4_ib_destroy_qp(struct ib_qp *qp)
11321132
if (is_qp0(dev, mqp))
11331133
mlx4_CLOSE_PORT(dev->dev, mqp->port);
11341134

1135+
if (dev->qp1_proxy[mqp->port - 1] == mqp) {
1136+
mutex_lock(&dev->qp1_proxy_lock[mqp->port - 1]);
1137+
dev->qp1_proxy[mqp->port - 1] = NULL;
1138+
mutex_unlock(&dev->qp1_proxy_lock[mqp->port - 1]);
1139+
}
1140+
11351141
pd = get_pd(mqp);
11361142
destroy_qp_common(dev, mqp, !!pd->ibpd.uobject);
11371143

@@ -1646,6 +1652,8 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
16461652
err = handle_eth_ud_smac_index(dev, qp, (u8 *)attr->smac, context);
16471653
if (err)
16481654
return -EINVAL;
1655+
if (qp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI)
1656+
dev->qp1_proxy[qp->port - 1] = qp;
16491657
}
16501658
}
16511659
}

‎drivers/net/bonding/bond_alb.c‎

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb)
8282
}
8383

8484
/* Forward declaration */
85-
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
85+
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
86+
bool strict_match);
8687
static void rlb_purge_src_ip(struct bonding *bond, struct arp_pkt *arp);
8788
static void rlb_src_unlink(struct bonding *bond, u32 index);
8889
static void rlb_src_link(struct bonding *bond, u32 ip_src_hash,
@@ -459,7 +460,7 @@ static void rlb_teach_disabled_mac_on_primary(struct bonding *bond, u8 addr[])
459460

460461
bond->alb_info.rlb_promisc_timeout_counter = 0;
461462

462-
alb_send_learning_packets(bond->curr_active_slave, addr);
463+
alb_send_learning_packets(bond->curr_active_slave, addr, true);
463464
}
464465

465466
/* slave being removed should not be active at this point
@@ -995,7 +996,7 @@ static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id)
995996
/*********************** tlb/rlb shared functions *********************/
996997

997998
static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
998-
u16 vid)
999+
__be16 vlan_proto, u16 vid)
9991000
{
10001001
struct learning_pkt pkt;
10011002
struct sk_buff *skb;
@@ -1021,7 +1022,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
10211022
skb->dev = slave->dev;
10221023

10231024
if (vid) {
1024-
skb = vlan_put_tag(skb, htons(ETH_P_8021Q), vid);
1025+
skb = vlan_put_tag(skb, vlan_proto, vid);
10251026
if (!skb) {
10261027
pr_err("%s: Error: failed to insert VLAN tag\n",
10271028
slave->bond->dev->name);
@@ -1032,22 +1033,32 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
10321033
dev_queue_xmit(skb);
10331034
}
10341035

1035-
1036-
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
1036+
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[],
1037+
bool strict_match)
10371038
{
10381039
struct bonding *bond = bond_get_bond_by_slave(slave);
10391040
struct net_device *upper;
10401041
struct list_head *iter;
10411042

10421043
/* send untagged */
1043-
alb_send_lp_vid(slave, mac_addr, 0);
1044+
alb_send_lp_vid(slave, mac_addr, 0, 0);
10441045

10451046
/* loop through vlans and send one packet for each */
10461047
rcu_read_lock();
10471048
netdev_for_each_all_upper_dev_rcu(bond->dev, upper, iter) {
1048-
if (upper->priv_flags & IFF_802_1Q_VLAN)
1049-
alb_send_lp_vid(slave, mac_addr,
1050-
vlan_dev_vlan_id(upper));
1049+
if (is_vlan_dev(upper) && vlan_get_encap_level(upper) == 0) {
1050+
if (strict_match &&
1051+
ether_addr_equal_64bits(mac_addr,
1052+
upper->dev_addr)) {
1053+
alb_send_lp_vid(slave, mac_addr,
1054+
vlan_dev_vlan_proto(upper),
1055+
vlan_dev_vlan_id(upper));
1056+
} else if (!strict_match) {
1057+
alb_send_lp_vid(slave, upper->dev_addr,
1058+
vlan_dev_vlan_proto(upper),
1059+
vlan_dev_vlan_id(upper));
1060+
}
1061+
}
10511062
}
10521063
rcu_read_unlock();
10531064
}
@@ -1107,7 +1118,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
11071118

11081119
/* fasten the change in the switch */
11091120
if (SLAVE_IS_OK(slave1)) {
1110-
alb_send_learning_packets(slave1, slave1->dev->dev_addr);
1121+
alb_send_learning_packets(slave1, slave1->dev->dev_addr, false);
11111122
if (bond->alb_info.rlb_enabled) {
11121123
/* inform the clients that the mac address
11131124
* has changed
@@ -1119,7 +1130,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
11191130
}
11201131

11211132
if (SLAVE_IS_OK(slave2)) {
1122-
alb_send_learning_packets(slave2, slave2->dev->dev_addr);
1133+
alb_send_learning_packets(slave2, slave2->dev->dev_addr, false);
11231134
if (bond->alb_info.rlb_enabled) {
11241135
/* inform the clients that the mac address
11251136
* has changed
@@ -1490,15 +1501,24 @@ void bond_alb_monitor(struct work_struct *work)
14901501

14911502
/* send learning packets */
14921503
if (bond_info->lp_counter >= BOND_ALB_LP_TICKS(bond)) {
1504+
bool strict_match;
1505+
14931506
/* change of curr_active_slave involves swapping of mac addresses.
14941507
* in order to avoid this swapping from happening while
14951508
* sending the learning packets, the curr_slave_lock must be held for
14961509
* read.
14971510
*/
14981511
read_lock(&bond->curr_slave_lock);
14991512

1500-
bond_for_each_slave_rcu(bond, slave, iter)
1501-
alb_send_learning_packets(slave, slave->dev->dev_addr);
1513+
bond_for_each_slave_rcu(bond, slave, iter) {
1514+
/* If updating current_active, use all currently
1515+
* user mac addreses (!strict_match). Otherwise, only
1516+
* use mac of the slave device.
1517+
*/
1518+
strict_match = (slave != bond->curr_active_slave);
1519+
alb_send_learning_packets(slave, slave->dev->dev_addr,
1520+
strict_match);
1521+
}
15021522

15031523
read_unlock(&bond->curr_slave_lock);
15041524

@@ -1721,7 +1741,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
17211741
} else {
17221742
/* set the new_slave to the bond mac address */
17231743
alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr);
1724-
alb_send_learning_packets(new_slave, bond->dev->dev_addr);
1744+
alb_send_learning_packets(new_slave, bond->dev->dev_addr,
1745+
false);
17251746
}
17261747

17271748
write_lock_bh(&bond->curr_slave_lock);
@@ -1764,7 +1785,8 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
17641785
alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr);
17651786

17661787
read_lock(&bond->lock);
1767-
alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
1788+
alb_send_learning_packets(bond->curr_active_slave,
1789+
bond_dev->dev_addr, false);
17681790
if (bond->alb_info.rlb_enabled) {
17691791
/* inform clients mac address has changed */
17701792
rlb_req_update_slave_clients(bond, bond->curr_active_slave);

0 commit comments

Comments
 (0)