Skip to content

Commit 75acfdb

Browse files
committed
Merge tag 'net-5.16-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Jakub Kicinski" "Networking fixes, including fixes from bpf, and WiFi. One last pull request, turns out some of the recent fixes did more harm than good. Current release - regressions: - Revert "xsk: Do not sleep in poll() when need_wakeup set", made the problem worse - Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register", broke EPROBE_DEFER handling - Revert "net: usb: r8152: Add MAC pass-through support for more Lenovo Docks", broke setups without a Lenovo dock Current release - new code bugs: - selftests: set amt.sh executable Previous releases - regressions: - batman-adv: mcast: don't send link-local multicast to mcast routers Previous releases - always broken: - ipv4/ipv6: check attribute length for RTA_FLOW / RTA_GATEWAY - sctp: hold endpoint before calling cb in sctp_transport_lookup_process - mac80211: mesh: embed mesh_paths and mpp_paths into ieee80211_if_mesh to avoid complicated handling of sub-object allocation failures - seg6: fix traceroute in the presence of SRv6 - tipc: fix a kernel-infoleak in __tipc_sendmsg()" * tag 'net-5.16-final' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (36 commits) selftests: set amt.sh executable Revert "net: usb: r8152: Add MAC passthrough support for more Lenovo Docks" sfc: The RX page_ring is optional iavf: Fix limit of total number of queues to active queues of VF i40e: Fix incorrect netdev's real number of RX/TX queues i40e: Fix for displaying message regarding NVM version i40e: fix use-after-free in i40e_sync_filters_subtask() i40e: Fix to not show opcode msg on unsuccessful VF MAC change ieee802154: atusb: fix uninit value in atusb_set_extended_addr mac80211: mesh: embedd mesh_paths and mpp_paths into ieee80211_if_mesh mac80211: initialize variable have_higher_than_11mbit sch_qfq: prevent shift-out-of-bounds in qfq_init_qdisc netrom: fix copying in user data in nr_setsockopt udp6: Use Segment Routing Header for dest address if present icmp: ICMPV6: Examine invoking packet for Segment Route Headers. seg6: export get_srh() for ICMP handling Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register" ipv6: Do cleanup if attribute validation fails in multipath route ipv6: Continue processing multipath route even if gateway attribute is invalid net/fsl: Remove leftover definition in xgmac_mdio ...
2 parents 49ef78e + db54c12 commit 75acfdb

File tree

38 files changed

+441
-229
lines changed

38 files changed

+441
-229
lines changed

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,26 +1288,22 @@ static int handle_invalid_req_id(struct ena_ring *ring, u16 req_id,
12881288

12891289
static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
12901290
{
1291-
struct ena_tx_buffer *tx_info = NULL;
1291+
struct ena_tx_buffer *tx_info;
12921292

1293-
if (likely(req_id < tx_ring->ring_size)) {
1294-
tx_info = &tx_ring->tx_buffer_info[req_id];
1295-
if (likely(tx_info->skb))
1296-
return 0;
1297-
}
1293+
tx_info = &tx_ring->tx_buffer_info[req_id];
1294+
if (likely(tx_info->skb))
1295+
return 0;
12981296

12991297
return handle_invalid_req_id(tx_ring, req_id, tx_info, false);
13001298
}
13011299

13021300
static int validate_xdp_req_id(struct ena_ring *xdp_ring, u16 req_id)
13031301
{
1304-
struct ena_tx_buffer *tx_info = NULL;
1302+
struct ena_tx_buffer *tx_info;
13051303

1306-
if (likely(req_id < xdp_ring->ring_size)) {
1307-
tx_info = &xdp_ring->tx_buffer_info[req_id];
1308-
if (likely(tx_info->xdpf))
1309-
return 0;
1310-
}
1304+
tx_info = &xdp_ring->tx_buffer_info[req_id];
1305+
if (likely(tx_info->xdpf))
1306+
return 0;
13111307

13121308
return handle_invalid_req_id(xdp_ring, req_id, tx_info, true);
13131309
}
@@ -1332,9 +1328,14 @@ static int ena_clean_tx_irq(struct ena_ring *tx_ring, u32 budget)
13321328

13331329
rc = ena_com_tx_comp_req_id_get(tx_ring->ena_com_io_cq,
13341330
&req_id);
1335-
if (rc)
1331+
if (rc) {
1332+
if (unlikely(rc == -EINVAL))
1333+
handle_invalid_req_id(tx_ring, req_id, NULL,
1334+
false);
13361335
break;
1336+
}
13371337

1338+
/* validate that the request id points to a valid skb */
13381339
rc = validate_tx_req_id(tx_ring, req_id);
13391340
if (rc)
13401341
break;
@@ -1427,6 +1428,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
14271428
u16 *next_to_clean)
14281429
{
14291430
struct ena_rx_buffer *rx_info;
1431+
struct ena_adapter *adapter;
14301432
u16 len, req_id, buf = 0;
14311433
struct sk_buff *skb;
14321434
void *page_addr;
@@ -1439,8 +1441,14 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
14391441
rx_info = &rx_ring->rx_buffer_info[req_id];
14401442

14411443
if (unlikely(!rx_info->page)) {
1442-
netif_err(rx_ring->adapter, rx_err, rx_ring->netdev,
1443-
"Page is NULL\n");
1444+
adapter = rx_ring->adapter;
1445+
netif_err(adapter, rx_err, rx_ring->netdev,
1446+
"Page is NULL. qid %u req_id %u\n", rx_ring->qid, req_id);
1447+
ena_increase_stat(&rx_ring->rx_stats.bad_req_id, 1, &rx_ring->syncp);
1448+
adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID;
1449+
/* Make sure reset reason is set before triggering the reset */
1450+
smp_mb__before_atomic();
1451+
set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
14441452
return NULL;
14451453
}
14461454

@@ -1896,9 +1904,14 @@ static int ena_clean_xdp_irq(struct ena_ring *xdp_ring, u32 budget)
18961904

18971905
rc = ena_com_tx_comp_req_id_get(xdp_ring->ena_com_io_cq,
18981906
&req_id);
1899-
if (rc)
1907+
if (rc) {
1908+
if (unlikely(rc == -EINVAL))
1909+
handle_invalid_req_id(xdp_ring, req_id, NULL,
1910+
true);
19001911
break;
1912+
}
19011913

1914+
/* validate that the request id points to a valid xdp_frame */
19021915
rc = validate_xdp_req_id(xdp_ring, req_id);
19031916
if (rc)
19041917
break;
@@ -4013,10 +4026,6 @@ static u32 ena_calc_max_io_queue_num(struct pci_dev *pdev,
40134026
max_num_io_queues = min_t(u32, max_num_io_queues, io_tx_cq_num);
40144027
/* 1 IRQ for mgmnt and 1 IRQs for each IO direction */
40154028
max_num_io_queues = min_t(u32, max_num_io_queues, pci_msix_vec_count(pdev) - 1);
4016-
if (unlikely(!max_num_io_queues)) {
4017-
dev_err(&pdev->dev, "The device doesn't have io queues\n");
4018-
return -EFAULT;
4019-
}
40204029

40214030
return max_num_io_queues;
40224031
}

drivers/net/ethernet/freescale/xgmac_mdio.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ struct tgec_mdio_controller {
4747
#define MDIO_CTL_READ BIT(15)
4848

4949
#define MDIO_DATA(x) (x & 0xffff)
50-
#define MDIO_DATA_BSY BIT(31)
5150

5251
struct mdio_fsl_priv {
5352
struct tgec_mdio_controller __iomem *mdio_base;

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ MODULE_LICENSE("GPL v2");
9999

100100
static struct workqueue_struct *i40e_wq;
101101

102+
static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f,
103+
struct net_device *netdev, int delta)
104+
{
105+
struct netdev_hw_addr *ha;
106+
107+
if (!f || !netdev)
108+
return;
109+
110+
netdev_for_each_mc_addr(ha, netdev) {
111+
if (ether_addr_equal(ha->addr, f->macaddr)) {
112+
ha->refcount += delta;
113+
if (ha->refcount <= 0)
114+
ha->refcount = 1;
115+
break;
116+
}
117+
}
118+
}
119+
102120
/**
103121
* i40e_allocate_dma_mem_d - OS specific memory alloc for shared code
104122
* @hw: pointer to the HW structure
@@ -2036,6 +2054,7 @@ static void i40e_undo_add_filter_entries(struct i40e_vsi *vsi,
20362054
hlist_for_each_entry_safe(new, h, from, hlist) {
20372055
/* We can simply free the wrapper structure */
20382056
hlist_del(&new->hlist);
2057+
netdev_hw_addr_refcnt(new->f, vsi->netdev, -1);
20392058
kfree(new);
20402059
}
20412060
}
@@ -2383,6 +2402,10 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
23832402
&tmp_add_list,
23842403
&tmp_del_list,
23852404
vlan_filters);
2405+
2406+
hlist_for_each_entry(new, &tmp_add_list, hlist)
2407+
netdev_hw_addr_refcnt(new->f, vsi->netdev, 1);
2408+
23862409
if (retval)
23872410
goto err_no_memory_locked;
23882411

@@ -2515,6 +2538,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
25152538
if (new->f->state == I40E_FILTER_NEW)
25162539
new->f->state = new->state;
25172540
hlist_del(&new->hlist);
2541+
netdev_hw_addr_refcnt(new->f, vsi->netdev, -1);
25182542
kfree(new);
25192543
}
25202544
spin_unlock_bh(&vsi->mac_filter_hash_lock);
@@ -8716,6 +8740,27 @@ int i40e_open(struct net_device *netdev)
87168740
return 0;
87178741
}
87188742

8743+
/**
8744+
* i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
8745+
* @vsi: vsi structure
8746+
*
8747+
* This updates netdev's number of tx/rx queues
8748+
*
8749+
* Returns status of setting tx/rx queues
8750+
**/
8751+
static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
8752+
{
8753+
int ret;
8754+
8755+
ret = netif_set_real_num_rx_queues(vsi->netdev,
8756+
vsi->num_queue_pairs);
8757+
if (ret)
8758+
return ret;
8759+
8760+
return netif_set_real_num_tx_queues(vsi->netdev,
8761+
vsi->num_queue_pairs);
8762+
}
8763+
87198764
/**
87208765
* i40e_vsi_open -
87218766
* @vsi: the VSI to open
@@ -8752,13 +8797,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
87528797
goto err_setup_rx;
87538798

87548799
/* Notify the stack of the actual queue counts. */
8755-
err = netif_set_real_num_tx_queues(vsi->netdev,
8756-
vsi->num_queue_pairs);
8757-
if (err)
8758-
goto err_set_queues;
8759-
8760-
err = netif_set_real_num_rx_queues(vsi->netdev,
8761-
vsi->num_queue_pairs);
8800+
err = i40e_netif_set_realnum_tx_rx_queues(vsi);
87628801
if (err)
87638802
goto err_set_queues;
87648803

@@ -14149,6 +14188,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
1414914188
case I40E_VSI_MAIN:
1415014189
case I40E_VSI_VMDQ2:
1415114190
ret = i40e_config_netdev(vsi);
14191+
if (ret)
14192+
goto err_netdev;
14193+
ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
1415214194
if (ret)
1415314195
goto err_netdev;
1415414196
ret = register_netdev(vsi->netdev);
@@ -15451,8 +15493,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1545115493

1545215494
if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
1545315495
hw->aq.api_min_ver > I40E_FW_MINOR_VERSION(hw))
15454-
dev_info(&pdev->dev,
15455-
"The driver for the device detected a newer version of the NVM image v%u.%u than expected v%u.%u. Please install the most recent version of the network driver.\n",
15496+
dev_dbg(&pdev->dev,
15497+
"The driver for the device detected a newer version of the NVM image v%u.%u than v%u.%u.\n",
1545615498
hw->aq.api_maj_ver,
1545715499
hw->aq.api_min_ver,
1545815500
I40E_FW_API_VERSION_MAJOR,

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,17 +1877,19 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
18771877
/***********************virtual channel routines******************/
18781878

18791879
/**
1880-
* i40e_vc_send_msg_to_vf
1880+
* i40e_vc_send_msg_to_vf_ex
18811881
* @vf: pointer to the VF info
18821882
* @v_opcode: virtual channel opcode
18831883
* @v_retval: virtual channel return value
18841884
* @msg: pointer to the msg buffer
18851885
* @msglen: msg length
1886+
* @is_quiet: true for not printing unsuccessful return values, false otherwise
18861887
*
18871888
* send msg to VF
18881889
**/
1889-
static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
1890-
u32 v_retval, u8 *msg, u16 msglen)
1890+
static int i40e_vc_send_msg_to_vf_ex(struct i40e_vf *vf, u32 v_opcode,
1891+
u32 v_retval, u8 *msg, u16 msglen,
1892+
bool is_quiet)
18911893
{
18921894
struct i40e_pf *pf;
18931895
struct i40e_hw *hw;
@@ -1903,7 +1905,7 @@ static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
19031905
abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
19041906

19051907
/* single place to detect unsuccessful return values */
1906-
if (v_retval) {
1908+
if (v_retval && !is_quiet) {
19071909
vf->num_invalid_msgs++;
19081910
dev_info(&pf->pdev->dev, "VF %d failed opcode %d, retval: %d\n",
19091911
vf->vf_id, v_opcode, v_retval);
@@ -1933,6 +1935,23 @@ static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
19331935
return 0;
19341936
}
19351937

1938+
/**
1939+
* i40e_vc_send_msg_to_vf
1940+
* @vf: pointer to the VF info
1941+
* @v_opcode: virtual channel opcode
1942+
* @v_retval: virtual channel return value
1943+
* @msg: pointer to the msg buffer
1944+
* @msglen: msg length
1945+
*
1946+
* send msg to VF
1947+
**/
1948+
static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
1949+
u32 v_retval, u8 *msg, u16 msglen)
1950+
{
1951+
return i40e_vc_send_msg_to_vf_ex(vf, v_opcode, v_retval,
1952+
msg, msglen, false);
1953+
}
1954+
19361955
/**
19371956
* i40e_vc_send_resp_to_vf
19381957
* @vf: pointer to the VF info
@@ -2695,6 +2714,7 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)
26952714
* i40e_check_vf_permission
26962715
* @vf: pointer to the VF info
26972716
* @al: MAC address list from virtchnl
2717+
* @is_quiet: set true for printing msg without opcode info, false otherwise
26982718
*
26992719
* Check that the given list of MAC addresses is allowed. Will return -EPERM
27002720
* if any address in the list is not valid. Checks the following conditions:
@@ -2709,13 +2729,15 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)
27092729
* addresses might not be accurate.
27102730
**/
27112731
static inline int i40e_check_vf_permission(struct i40e_vf *vf,
2712-
struct virtchnl_ether_addr_list *al)
2732+
struct virtchnl_ether_addr_list *al,
2733+
bool *is_quiet)
27132734
{
27142735
struct i40e_pf *pf = vf->pf;
27152736
struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
27162737
int mac2add_cnt = 0;
27172738
int i;
27182739

2740+
*is_quiet = false;
27192741
for (i = 0; i < al->num_elements; i++) {
27202742
struct i40e_mac_filter *f;
27212743
u8 *addr = al->list[i].addr;
@@ -2739,6 +2761,7 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,
27392761
!ether_addr_equal(addr, vf->default_lan_addr.addr)) {
27402762
dev_err(&pf->pdev->dev,
27412763
"VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\n");
2764+
*is_quiet = true;
27422765
return -EPERM;
27432766
}
27442767

@@ -2775,6 +2798,7 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
27752798
(struct virtchnl_ether_addr_list *)msg;
27762799
struct i40e_pf *pf = vf->pf;
27772800
struct i40e_vsi *vsi = NULL;
2801+
bool is_quiet = false;
27782802
i40e_status ret = 0;
27792803
int i;
27802804

@@ -2791,7 +2815,7 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
27912815
*/
27922816
spin_lock_bh(&vsi->mac_filter_hash_lock);
27932817

2794-
ret = i40e_check_vf_permission(vf, al);
2818+
ret = i40e_check_vf_permission(vf, al, &is_quiet);
27952819
if (ret) {
27962820
spin_unlock_bh(&vsi->mac_filter_hash_lock);
27972821
goto error_param;
@@ -2829,8 +2853,8 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)
28292853

28302854
error_param:
28312855
/* send the response to the VF */
2832-
return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ADD_ETH_ADDR,
2833-
ret);
2856+
return i40e_vc_send_msg_to_vf_ex(vf, VIRTCHNL_OP_ADD_ETH_ADDR,
2857+
ret, NULL, 0, is_quiet);
28342858
}
28352859

28362860
/**

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2708,8 +2708,11 @@ static int iavf_validate_ch_config(struct iavf_adapter *adapter,
27082708
total_max_rate += tx_rate;
27092709
num_qps += mqprio_qopt->qopt.count[i];
27102710
}
2711-
if (num_qps > IAVF_MAX_REQ_QUEUES)
2711+
if (num_qps > adapter->num_active_queues) {
2712+
dev_err(&adapter->pdev->dev,
2713+
"Cannot support requested number of queues\n");
27122714
return -EINVAL;
2715+
}
27132716

27142717
ret = iavf_validate_tx_bandwidth(adapter, total_max_rate);
27152718
return ret;

drivers/net/ethernet/sfc/falcon/rx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ static struct page *ef4_reuse_page(struct ef4_rx_queue *rx_queue)
110110
struct ef4_rx_page_state *state;
111111
unsigned index;
112112

113+
if (unlikely(!rx_queue->page_ring))
114+
return NULL;
113115
index = rx_queue->page_remove & rx_queue->page_ptr_mask;
114116
page = rx_queue->page_ring[index];
115117
if (page == NULL)
@@ -293,6 +295,9 @@ static void ef4_recycle_rx_pages(struct ef4_channel *channel,
293295
{
294296
struct ef4_rx_queue *rx_queue = ef4_channel_get_rx_queue(channel);
295297

298+
if (unlikely(!rx_queue->page_ring))
299+
return;
300+
296301
do {
297302
ef4_recycle_rx_page(channel, rx_buf);
298303
rx_buf = ef4_rx_buf_next(rx_queue, rx_buf);

drivers/net/ethernet/sfc/rx_common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ static struct page *efx_reuse_page(struct efx_rx_queue *rx_queue)
4545
unsigned int index;
4646
struct page *page;
4747

48+
if (unlikely(!rx_queue->page_ring))
49+
return NULL;
4850
index = rx_queue->page_remove & rx_queue->page_ptr_mask;
4951
page = rx_queue->page_ring[index];
5052
if (page == NULL)
@@ -114,6 +116,9 @@ void efx_recycle_rx_pages(struct efx_channel *channel,
114116
{
115117
struct efx_rx_queue *rx_queue = efx_channel_get_rx_queue(channel);
116118

119+
if (unlikely(!rx_queue->page_ring))
120+
return;
121+
117122
do {
118123
efx_recycle_rx_page(channel, rx_buf);
119124
rx_buf = efx_rx_buf_next(rx_queue, rx_buf);

0 commit comments

Comments
 (0)