Skip to content

Commit ac3a0c8

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from David Miller: 1) Encap offset calculation is incorrect in esp6, from Sabrina Dubroca. 2) Better parameter validation in pfkey_dump(), from Mark Salyzyn. 3) Fix several clang issues on powerpc in selftests, from Tanner Love. 4) cmsghdr_from_user_compat_to_kern() uses the wrong length, from Al Viro. 5) Out of bounds access in mlx5e driver, from Raed Salem. 6) Fix transfer buffer memleak in lan78xx, from Johan Havold. 7) RCU fixups in rhashtable, from Herbert Xu. 8) Fix ipv6 nexthop refcnt leak, from Xiyu Yang. 9) vxlan FDB dump must be done under RCU, from Ido Schimmel. 10) Fix use after free in mlxsw, from Ido Schimmel. 11) Fix map leak in HASH_OF_MAPS bpf code, from Andrii Nakryiko. 12) Fix bug in mac80211 Tx ack status reporting, from Vasanthakumar Thiagarajan. 13) Fix memory leaks in IPV6_ADDRFORM code, from Cong Wang. 14) Fix bpf program reference count leaks in mlx5 during mlx5e_alloc_rq(), from Xin Xiong. * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (86 commits) vxlan: fix memleak of fdb rds: Prevent kernel-infoleak in rds_notify_queue_get() net/sched: The error lable position is corrected in ct_init_module net/mlx5e: fix bpf_prog reference count leaks in mlx5e_alloc_rq net/mlx5e: E-Switch, Specify flow_source for rule with no in_port net/mlx5e: E-Switch, Add misc bit when misc fields changed for mirroring net/mlx5e: CT: Support restore ipv6 tunnel net: gemini: Fix missing clk_disable_unprepare() in error path of gemini_ethernet_port_probe() ionic: unlock queue mutex in error path atm: fix atm_dev refcnt leaks in atmtcp_remove_persistent net: ethernet: mtk_eth_soc: fix MTU warnings net: nixge: fix potential memory leak in nixge_probe() devlink: ignore -EOPNOTSUPP errors on dumpit rxrpc: Fix race between recvmsg and sendmsg on immediate call failure MAINTAINERS: Replace Thor Thayer as Altera Triple Speed Ethernet maintainer selftests/bpf: fix netdevsim trap_flow_action_cookie read ipv6: fix memory leaks on IPV6_ADDRFORM path net/bpfilter: Initialize pos in __bpfilter_process_sockopt igb: reinit_locked() should be called with rtnl_lock e1000e: continue to init PHY even when failed to disable ULP ...
2 parents 0ae3495 + fda2ec6 commit ac3a0c8

Some content is hidden

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

81 files changed

+782
-451
lines changed

Documentation/networking/bareudp.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ There are various L3 encapsulation standards using UDP being discussed to
88
leverage the UDP based load balancing capability of different networks.
99
MPLSoUDP (__ https://tools.ietf.org/html/rfc7510) is one among them.
1010

11-
The Bareudp tunnel module provides a generic L3 encapsulation tunnelling
12-
support for tunnelling different L3 protocols like MPLS, IP, NSH etc. inside
13-
a UDP tunnel.
11+
The Bareudp tunnel module provides a generic L3 encapsulation support for
12+
tunnelling different L3 protocols like MPLS, IP, NSH etc. inside a UDP tunnel.
1413

1514
Special Handling
1615
----------------

Documentation/networking/devlink/devlink-trap.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ narrow. The description of these groups must be added to the following table:
486486
- Contains packet traps for packets that should be locally delivered after
487487
routing, but do not match more specific packet traps (e.g.,
488488
``ipv4_bgp``)
489+
* - ``external_delivery``
490+
- Contains packet traps for packets that should be routed through an
491+
external interface (e.g., management interface) that does not belong to
492+
the same device (e.g., switch ASIC) as the ingress interface
489493
* - ``ipv6``
490494
- Contains packet traps for various IPv6 control packets (e.g., Router
491495
Advertisements)

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ F: include/dt-bindings/reset/altr,rst-mgr-a10sr.h
782782
F: include/linux/mfd/altera-a10sr.h
783783

784784
ALTERA TRIPLE SPEED ETHERNET DRIVER
785-
M: Thor Thayer <thor.thayer@linux.intel.com>
785+
M: Joyce Ooi <joyce.ooi@intel.com>
786786
787787
S: Maintained
788788
F: drivers/net/ethernet/altera/

drivers/atm/atmtcp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,15 @@ static int atmtcp_remove_persistent(int itf)
433433
return -EMEDIUMTYPE;
434434
}
435435
dev_data = PRIV(dev);
436-
if (!dev_data->persist) return 0;
436+
if (!dev_data->persist) {
437+
atm_dev_put(dev);
438+
return 0;
439+
}
437440
dev_data->persist = 0;
438-
if (PRIV(dev)->vcc) return 0;
441+
if (PRIV(dev)->vcc) {
442+
atm_dev_put(dev);
443+
return 0;
444+
}
439445
kfree(dev_data);
440446
atm_dev_put(dev);
441447
atm_dev_deregister(dev);

drivers/net/bareudp.c

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,19 +407,34 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
407407
return err;
408408
}
409409

410+
static bool bareudp_proto_valid(struct bareudp_dev *bareudp, __be16 proto)
411+
{
412+
if (bareudp->ethertype == proto)
413+
return true;
414+
415+
if (!bareudp->multi_proto_mode)
416+
return false;
417+
418+
if (bareudp->ethertype == htons(ETH_P_MPLS_UC) &&
419+
proto == htons(ETH_P_MPLS_MC))
420+
return true;
421+
422+
if (bareudp->ethertype == htons(ETH_P_IP) &&
423+
proto == htons(ETH_P_IPV6))
424+
return true;
425+
426+
return false;
427+
}
428+
410429
static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev)
411430
{
412431
struct bareudp_dev *bareudp = netdev_priv(dev);
413432
struct ip_tunnel_info *info = NULL;
414433
int err;
415434

416-
if (skb->protocol != bareudp->ethertype) {
417-
if (!bareudp->multi_proto_mode ||
418-
(skb->protocol != htons(ETH_P_MPLS_MC) &&
419-
skb->protocol != htons(ETH_P_IPV6))) {
420-
err = -EINVAL;
421-
goto tx_error;
422-
}
435+
if (!bareudp_proto_valid(bareudp, skb->protocol)) {
436+
err = -EINVAL;
437+
goto tx_error;
423438
}
424439

425440
info = skb_tunnel_info(skb);

drivers/net/ethernet/cortina/gemini.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2446,6 +2446,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
24462446
port->reset = devm_reset_control_get_exclusive(dev, NULL);
24472447
if (IS_ERR(port->reset)) {
24482448
dev_err(dev, "no reset\n");
2449+
clk_disable_unprepare(port->pclk);
24492450
return PTR_ERR(port->reset);
24502451
}
24512452
reset_control_reset(port->reset);
@@ -2501,8 +2502,10 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
25012502
IRQF_SHARED,
25022503
port_names[port->id],
25032504
port);
2504-
if (ret)
2505+
if (ret) {
2506+
clk_disable_unprepare(port->pclk);
25052507
return ret;
2508+
}
25062509

25072510
ret = register_netdev(netdev);
25082511
if (!ret) {

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,16 +1093,8 @@ static int hns3_fill_desc(struct hns3_enet_ring *ring, void *priv,
10931093
int k, sizeoflast;
10941094
dma_addr_t dma;
10951095

1096-
if (type == DESC_TYPE_SKB) {
1097-
struct sk_buff *skb = (struct sk_buff *)priv;
1098-
int ret;
1099-
1100-
ret = hns3_fill_skb_desc(ring, skb, desc);
1101-
if (unlikely(ret < 0))
1102-
return ret;
1103-
1104-
dma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE);
1105-
} else if (type == DESC_TYPE_FRAGLIST_SKB) {
1096+
if (type == DESC_TYPE_FRAGLIST_SKB ||
1097+
type == DESC_TYPE_SKB) {
11061098
struct sk_buff *skb = (struct sk_buff *)priv;
11071099

11081100
dma = dma_map_single(dev, skb->data, size, DMA_TO_DEVICE);
@@ -1439,6 +1431,10 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
14391431

14401432
next_to_use_head = ring->next_to_use;
14411433

1434+
ret = hns3_fill_skb_desc(ring, skb, &ring->desc[ring->next_to_use]);
1435+
if (unlikely(ret < 0))
1436+
goto fill_err;
1437+
14421438
ret = hns3_fill_skb_to_desc(ring, skb, DESC_TYPE_SKB);
14431439
if (unlikely(ret < 0))
14441440
goto fill_err;
@@ -4140,8 +4136,8 @@ static void hns3_link_status_change(struct hnae3_handle *handle, bool linkup)
41404136
return;
41414137

41424138
if (linkup) {
4143-
netif_carrier_on(netdev);
41444139
netif_tx_wake_all_queues(netdev);
4140+
netif_carrier_on(netdev);
41454141
if (netif_msg_link(handle))
41464142
netdev_info(netdev, "link up\n");
41474143
} else {

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5806,9 +5806,9 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle,
58065806
/* to avoid rule conflict, when user configure rule by ethtool,
58075807
* we need to clear all arfs rules
58085808
*/
5809+
spin_lock_bh(&hdev->fd_rule_lock);
58095810
hclge_clear_arfs_rules(handle);
58105811

5811-
spin_lock_bh(&hdev->fd_rule_lock);
58125812
ret = hclge_fd_config_rule(hdev, rule);
58135813

58145814
spin_unlock_bh(&hdev->fd_rule_lock);
@@ -5851,6 +5851,7 @@ static int hclge_del_fd_entry(struct hnae3_handle *handle,
58515851
return ret;
58525852
}
58535853

5854+
/* make sure being called after lock up with fd_rule_lock */
58545855
static void hclge_del_all_fd_entries(struct hnae3_handle *handle,
58555856
bool clear_list)
58565857
{
@@ -5863,7 +5864,6 @@ static void hclge_del_all_fd_entries(struct hnae3_handle *handle,
58635864
if (!hnae3_dev_fd_supported(hdev))
58645865
return;
58655866

5866-
spin_lock_bh(&hdev->fd_rule_lock);
58675867
for_each_set_bit(location, hdev->fd_bmap,
58685868
hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1])
58695869
hclge_fd_tcam_config(hdev, HCLGE_FD_STAGE_1, true, location,
@@ -5880,8 +5880,6 @@ static void hclge_del_all_fd_entries(struct hnae3_handle *handle,
58805880
bitmap_zero(hdev->fd_bmap,
58815881
hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]);
58825882
}
5883-
5884-
spin_unlock_bh(&hdev->fd_rule_lock);
58855883
}
58865884

58875885
static int hclge_restore_fd_entries(struct hnae3_handle *handle)
@@ -6263,7 +6261,7 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
62636261
u16 flow_id, struct flow_keys *fkeys)
62646262
{
62656263
struct hclge_vport *vport = hclge_get_vport(handle);
6266-
struct hclge_fd_rule_tuples new_tuples;
6264+
struct hclge_fd_rule_tuples new_tuples = {};
62676265
struct hclge_dev *hdev = vport->back;
62686266
struct hclge_fd_rule *rule;
62696267
u16 tmp_queue_id;
@@ -6273,19 +6271,17 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
62736271
if (!hnae3_dev_fd_supported(hdev))
62746272
return -EOPNOTSUPP;
62756273

6276-
memset(&new_tuples, 0, sizeof(new_tuples));
6277-
hclge_fd_get_flow_tuples(fkeys, &new_tuples);
6278-
6279-
spin_lock_bh(&hdev->fd_rule_lock);
6280-
62816274
/* when there is already fd rule existed add by user,
62826275
* arfs should not work
62836276
*/
6277+
spin_lock_bh(&hdev->fd_rule_lock);
62846278
if (hdev->fd_active_type == HCLGE_FD_EP_ACTIVE) {
62856279
spin_unlock_bh(&hdev->fd_rule_lock);
62866280
return -EOPNOTSUPP;
62876281
}
62886282

6283+
hclge_fd_get_flow_tuples(fkeys, &new_tuples);
6284+
62896285
/* check is there flow director filter existed for this flow,
62906286
* if not, create a new filter for it;
62916287
* if filter exist with different queue id, modify the filter;
@@ -6368,6 +6364,7 @@ static void hclge_rfs_filter_expire(struct hclge_dev *hdev)
63686364
#endif
63696365
}
63706366

6367+
/* make sure being called after lock up with fd_rule_lock */
63716368
static void hclge_clear_arfs_rules(struct hnae3_handle *handle)
63726369
{
63736370
#ifdef CONFIG_RFS_ACCEL
@@ -6420,10 +6417,14 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable)
64206417

64216418
hdev->fd_en = enable;
64226419
clear = hdev->fd_active_type == HCLGE_FD_ARFS_ACTIVE;
6423-
if (!enable)
6420+
6421+
if (!enable) {
6422+
spin_lock_bh(&hdev->fd_rule_lock);
64246423
hclge_del_all_fd_entries(handle, clear);
6425-
else
6424+
spin_unlock_bh(&hdev->fd_rule_lock);
6425+
} else {
64266426
hclge_restore_fd_entries(handle);
6427+
}
64276428
}
64286429

64296430
static void hclge_cfg_mac_mode(struct hclge_dev *hdev, bool enable)
@@ -6886,8 +6887,9 @@ static void hclge_ae_stop(struct hnae3_handle *handle)
68866887
int i;
68876888

68886889
set_bit(HCLGE_STATE_DOWN, &hdev->state);
6889-
6890+
spin_lock_bh(&hdev->fd_rule_lock);
68906891
hclge_clear_arfs_rules(handle);
6892+
spin_unlock_bh(&hdev->fd_rule_lock);
68916893

68926894
/* If it is not PF reset, the firmware will disable the MAC,
68936895
* so it only need to stop phy here.
@@ -9040,11 +9042,12 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto,
90409042
bool writen_to_tbl = false;
90419043
int ret = 0;
90429044

9043-
/* When device is resetting, firmware is unable to handle
9044-
* mailbox. Just record the vlan id, and remove it after
9045+
/* When device is resetting or reset failed, firmware is unable to
9046+
* handle mailbox. Just record the vlan id, and remove it after
90459047
* reset finished.
90469048
*/
9047-
if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) && is_kill) {
9049+
if ((test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) ||
9050+
test_bit(HCLGE_STATE_RST_FAIL, &hdev->state)) && is_kill) {
90489051
set_bit(vlan_id, vport->vlan_del_fail_bmap);
90499052
return -EBUSY;
90509053
}

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,11 +1592,12 @@ static int hclgevf_set_vlan_filter(struct hnae3_handle *handle,
15921592
if (proto != htons(ETH_P_8021Q))
15931593
return -EPROTONOSUPPORT;
15941594

1595-
/* When device is resetting, firmware is unable to handle
1596-
* mailbox. Just record the vlan id, and remove it after
1595+
/* When device is resetting or reset failed, firmware is unable to
1596+
* handle mailbox. Just record the vlan id, and remove it after
15971597
* reset finished.
15981598
*/
1599-
if (test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) && is_kill) {
1599+
if ((test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) ||
1600+
test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state)) && is_kill) {
16001601
set_bit(vlan_id, hdev->vlan_del_fail_bmap);
16011602
return -EBUSY;
16021603
}
@@ -3439,23 +3440,36 @@ void hclgevf_update_port_base_vlan_info(struct hclgevf_dev *hdev, u16 state,
34393440
{
34403441
struct hnae3_handle *nic = &hdev->nic;
34413442
struct hclge_vf_to_pf_msg send_msg;
3443+
int ret;
34423444

34433445
rtnl_lock();
3444-
hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT);
3445-
rtnl_unlock();
3446+
3447+
if (test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state) ||
3448+
test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state)) {
3449+
dev_warn(&hdev->pdev->dev,
3450+
"is resetting when updating port based vlan info\n");
3451+
rtnl_unlock();
3452+
return;
3453+
}
3454+
3455+
ret = hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT);
3456+
if (ret) {
3457+
rtnl_unlock();
3458+
return;
3459+
}
34463460

34473461
/* send msg to PF and wait update port based vlan info */
34483462
hclgevf_build_send_msg(&send_msg, HCLGE_MBX_SET_VLAN,
34493463
HCLGE_MBX_PORT_BASE_VLAN_CFG);
34503464
memcpy(send_msg.data, port_base_vlan_info, data_size);
3451-
hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
3452-
3453-
if (state == HNAE3_PORT_BASE_VLAN_DISABLE)
3454-
nic->port_base_vlan_state = HNAE3_PORT_BASE_VLAN_DISABLE;
3455-
else
3456-
nic->port_base_vlan_state = HNAE3_PORT_BASE_VLAN_ENABLE;
3465+
ret = hclgevf_send_mbx_msg(hdev, &send_msg, false, NULL, 0);
3466+
if (!ret) {
3467+
if (state == HNAE3_PORT_BASE_VLAN_DISABLE)
3468+
nic->port_base_vlan_state = state;
3469+
else
3470+
nic->port_base_vlan_state = HNAE3_PORT_BASE_VLAN_ENABLE;
3471+
}
34573472

3458-
rtnl_lock();
34593473
hclgevf_notify_client(hdev, HNAE3_UP_CLIENT);
34603474
rtnl_unlock();
34613475
}

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3206,7 +3206,7 @@ static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter)
32063206
req_tx_irq_failed:
32073207
for (j = 0; j < i; j++) {
32083208
free_irq(adapter->tx_scrq[j]->irq, adapter->tx_scrq[j]);
3209-
irq_dispose_mapping(adapter->rx_scrq[j]->irq);
3209+
irq_dispose_mapping(adapter->tx_scrq[j]->irq);
32103210
}
32113211
release_sub_crqs(adapter, 1);
32123212
return rc;

0 commit comments

Comments
 (0)