Commit 75acfdb6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents 49ef78e5 db54c12a
Loading
Loading
Loading
Loading
+29 −20
Original line number Original line Diff line number Diff line
@@ -1288,26 +1288,22 @@ static int handle_invalid_req_id(struct ena_ring *ring, u16 req_id,


static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
static int validate_tx_req_id(struct ena_ring *tx_ring, u16 req_id)
{
{
	struct ena_tx_buffer *tx_info = NULL;
	struct ena_tx_buffer *tx_info;


	if (likely(req_id < tx_ring->ring_size)) {
	tx_info = &tx_ring->tx_buffer_info[req_id];
	tx_info = &tx_ring->tx_buffer_info[req_id];
	if (likely(tx_info->skb))
	if (likely(tx_info->skb))
		return 0;
		return 0;
	}


	return handle_invalid_req_id(tx_ring, req_id, tx_info, false);
	return handle_invalid_req_id(tx_ring, req_id, tx_info, false);
}
}


static int validate_xdp_req_id(struct ena_ring *xdp_ring, u16 req_id)
static int validate_xdp_req_id(struct ena_ring *xdp_ring, u16 req_id)
{
{
	struct ena_tx_buffer *tx_info = NULL;
	struct ena_tx_buffer *tx_info;


	if (likely(req_id < xdp_ring->ring_size)) {
	tx_info = &xdp_ring->tx_buffer_info[req_id];
	tx_info = &xdp_ring->tx_buffer_info[req_id];
	if (likely(tx_info->xdpf))
	if (likely(tx_info->xdpf))
		return 0;
		return 0;
	}


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


		rc = ena_com_tx_comp_req_id_get(tx_ring->ena_com_io_cq,
		rc = ena_com_tx_comp_req_id_get(tx_ring->ena_com_io_cq,
						&req_id);
						&req_id);
		if (rc)
		if (rc) {
			if (unlikely(rc == -EINVAL))
				handle_invalid_req_id(tx_ring, req_id, NULL,
						      false);
			break;
			break;
		}


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


	if (unlikely(!rx_info->page)) {
	if (unlikely(!rx_info->page)) {
		netif_err(rx_ring->adapter, rx_err, rx_ring->netdev,
		adapter = rx_ring->adapter;
			  "Page is NULL\n");
		netif_err(adapter, rx_err, rx_ring->netdev,
			  "Page is NULL. qid %u req_id %u\n", rx_ring->qid, req_id);
		ena_increase_stat(&rx_ring->rx_stats.bad_req_id, 1, &rx_ring->syncp);
		adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID;
		/* Make sure reset reason is set before triggering the reset */
		smp_mb__before_atomic();
		set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
		return NULL;
		return NULL;
	}
	}


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


		rc = ena_com_tx_comp_req_id_get(xdp_ring->ena_com_io_cq,
		rc = ena_com_tx_comp_req_id_get(xdp_ring->ena_com_io_cq,
						&req_id);
						&req_id);
		if (rc)
		if (rc) {
			if (unlikely(rc == -EINVAL))
				handle_invalid_req_id(xdp_ring, req_id, NULL,
						      true);
			break;
			break;
		}


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


	return max_num_io_queues;
	return max_num_io_queues;
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -47,7 +47,6 @@ struct tgec_mdio_controller {
#define MDIO_CTL_READ		BIT(15)
#define MDIO_CTL_READ		BIT(15)


#define MDIO_DATA(x)		(x & 0xffff)
#define MDIO_DATA(x)		(x & 0xffff)
#define MDIO_DATA_BSY		BIT(31)


struct mdio_fsl_priv {
struct mdio_fsl_priv {
	struct	tgec_mdio_controller __iomem *mdio_base;
	struct	tgec_mdio_controller __iomem *mdio_base;
+51 −9
Original line number Original line Diff line number Diff line
@@ -99,6 +99,24 @@ MODULE_LICENSE("GPL v2");


static struct workqueue_struct *i40e_wq;
static struct workqueue_struct *i40e_wq;


static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f,
				  struct net_device *netdev, int delta)
{
	struct netdev_hw_addr *ha;

	if (!f || !netdev)
		return;

	netdev_for_each_mc_addr(ha, netdev) {
		if (ether_addr_equal(ha->addr, f->macaddr)) {
			ha->refcount += delta;
			if (ha->refcount <= 0)
				ha->refcount = 1;
			break;
		}
	}
}

/**
/**
 * i40e_allocate_dma_mem_d - OS specific memory alloc for shared code
 * i40e_allocate_dma_mem_d - OS specific memory alloc for shared code
 * @hw:   pointer to the HW structure
 * @hw:   pointer to the HW structure
@@ -2036,6 +2054,7 @@ static void i40e_undo_add_filter_entries(struct i40e_vsi *vsi,
	hlist_for_each_entry_safe(new, h, from, hlist) {
	hlist_for_each_entry_safe(new, h, from, hlist) {
		/* We can simply free the wrapper structure */
		/* We can simply free the wrapper structure */
		hlist_del(&new->hlist);
		hlist_del(&new->hlist);
		netdev_hw_addr_refcnt(new->f, vsi->netdev, -1);
		kfree(new);
		kfree(new);
	}
	}
}
}
@@ -2383,6 +2402,10 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
						       &tmp_add_list,
						       &tmp_add_list,
						       &tmp_del_list,
						       &tmp_del_list,
						       vlan_filters);
						       vlan_filters);

		hlist_for_each_entry(new, &tmp_add_list, hlist)
			netdev_hw_addr_refcnt(new->f, vsi->netdev, 1);

		if (retval)
		if (retval)
			goto err_no_memory_locked;
			goto err_no_memory_locked;


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


/**
 * i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
 * @vsi: vsi structure
 *
 * This updates netdev's number of tx/rx queues
 *
 * Returns status of setting tx/rx queues
 **/
static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
{
	int ret;

	ret = netif_set_real_num_rx_queues(vsi->netdev,
					   vsi->num_queue_pairs);
	if (ret)
		return ret;

	return netif_set_real_num_tx_queues(vsi->netdev,
					    vsi->num_queue_pairs);
}

/**
/**
 * i40e_vsi_open -
 * i40e_vsi_open -
 * @vsi: the VSI to open
 * @vsi: the VSI to open
@@ -8752,13 +8797,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
			goto err_setup_rx;
			goto err_setup_rx;


		/* Notify the stack of the actual queue counts. */
		/* Notify the stack of the actual queue counts. */
		err = netif_set_real_num_tx_queues(vsi->netdev,
		err = i40e_netif_set_realnum_tx_rx_queues(vsi);
						   vsi->num_queue_pairs);
		if (err)
			goto err_set_queues;

		err = netif_set_real_num_rx_queues(vsi->netdev,
						   vsi->num_queue_pairs);
		if (err)
		if (err)
			goto err_set_queues;
			goto err_set_queues;


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


	if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
	if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR &&
	    hw->aq.api_min_ver > I40E_FW_MINOR_VERSION(hw))
	    hw->aq.api_min_ver > I40E_FW_MINOR_VERSION(hw))
		dev_info(&pdev->dev,
		dev_dbg(&pdev->dev,
			 "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",
			"The driver for the device detected a newer version of the NVM image v%u.%u than v%u.%u.\n",
			 hw->aq.api_maj_ver,
			 hw->aq.api_maj_ver,
			 hw->aq.api_min_ver,
			 hw->aq.api_min_ver,
			 I40E_FW_API_VERSION_MAJOR,
			 I40E_FW_API_VERSION_MAJOR,
+32 −8
Original line number Original line Diff line number Diff line
@@ -1877,17 +1877,19 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
/***********************virtual channel routines******************/
/***********************virtual channel routines******************/


/**
/**
 * i40e_vc_send_msg_to_vf
 * i40e_vc_send_msg_to_vf_ex
 * @vf: pointer to the VF info
 * @vf: pointer to the VF info
 * @v_opcode: virtual channel opcode
 * @v_opcode: virtual channel opcode
 * @v_retval: virtual channel return value
 * @v_retval: virtual channel return value
 * @msg: pointer to the msg buffer
 * @msg: pointer to the msg buffer
 * @msglen: msg length
 * @msglen: msg length
 * @is_quiet: true for not printing unsuccessful return values, false otherwise
 *
 *
 * send msg to VF
 * send msg to VF
 **/
 **/
static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
static int i40e_vc_send_msg_to_vf_ex(struct i40e_vf *vf, u32 v_opcode,
				  u32 v_retval, u8 *msg, u16 msglen)
				     u32 v_retval, u8 *msg, u16 msglen,
				     bool is_quiet)
{
{
	struct i40e_pf *pf;
	struct i40e_pf *pf;
	struct i40e_hw *hw;
	struct i40e_hw *hw;
@@ -1903,7 +1905,7 @@ static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
	abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
	abs_vf_id = vf->vf_id + hw->func_caps.vf_base_id;


	/* single place to detect unsuccessful return values */
	/* single place to detect unsuccessful return values */
	if (v_retval) {
	if (v_retval && !is_quiet) {
		vf->num_invalid_msgs++;
		vf->num_invalid_msgs++;
		dev_info(&pf->pdev->dev, "VF %d failed opcode %d, retval: %d\n",
		dev_info(&pf->pdev->dev, "VF %d failed opcode %d, retval: %d\n",
			 vf->vf_id, v_opcode, v_retval);
			 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,
	return 0;
	return 0;
}
}


/**
 * i40e_vc_send_msg_to_vf
 * @vf: pointer to the VF info
 * @v_opcode: virtual channel opcode
 * @v_retval: virtual channel return value
 * @msg: pointer to the msg buffer
 * @msglen: msg length
 *
 * send msg to VF
 **/
static int i40e_vc_send_msg_to_vf(struct i40e_vf *vf, u32 v_opcode,
				  u32 v_retval, u8 *msg, u16 msglen)
{
	return i40e_vc_send_msg_to_vf_ex(vf, v_opcode, v_retval,
					 msg, msglen, false);
}

/**
/**
 * i40e_vc_send_resp_to_vf
 * i40e_vc_send_resp_to_vf
 * @vf: pointer to the VF info
 * @vf: pointer to the VF info
@@ -2695,6 +2714,7 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)
 * i40e_check_vf_permission
 * i40e_check_vf_permission
 * @vf: pointer to the VF info
 * @vf: pointer to the VF info
 * @al: MAC address list from virtchnl
 * @al: MAC address list from virtchnl
 * @is_quiet: set true for printing msg without opcode info, false otherwise
 *
 *
 * Check that the given list of MAC addresses is allowed. Will return -EPERM
 * Check that the given list of MAC addresses is allowed. Will return -EPERM
 * if any address in the list is not valid. Checks the following conditions:
 * 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)
 * addresses might not be accurate.
 * addresses might not be accurate.
 **/
 **/
static inline int i40e_check_vf_permission(struct i40e_vf *vf,
static inline int i40e_check_vf_permission(struct i40e_vf *vf,
					   struct virtchnl_ether_addr_list *al)
					   struct virtchnl_ether_addr_list *al,
					   bool *is_quiet)
{
{
	struct i40e_pf *pf = vf->pf;
	struct i40e_pf *pf = vf->pf;
	struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
	struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
	int mac2add_cnt = 0;
	int mac2add_cnt = 0;
	int i;
	int i;


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


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


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


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


error_param:
error_param:
	/* send the response to the VF */
	/* send the response to the VF */
	return i40e_vc_send_resp_to_vf(vf, VIRTCHNL_OP_ADD_ETH_ADDR,
	return i40e_vc_send_msg_to_vf_ex(vf, VIRTCHNL_OP_ADD_ETH_ADDR,
				       ret);
				       ret, NULL, 0, is_quiet);
}
}


/**
/**
+4 −1
Original line number Original line Diff line number Diff line
@@ -2708,8 +2708,11 @@ static int iavf_validate_ch_config(struct iavf_adapter *adapter,
		total_max_rate += tx_rate;
		total_max_rate += tx_rate;
		num_qps += mqprio_qopt->qopt.count[i];
		num_qps += mqprio_qopt->qopt.count[i];
	}
	}
	if (num_qps > IAVF_MAX_REQ_QUEUES)
	if (num_qps > adapter->num_active_queues) {
		dev_err(&adapter->pdev->dev,
			"Cannot support requested number of queues\n");
		return -EINVAL;
		return -EINVAL;
	}


	ret = iavf_validate_tx_bandwidth(adapter, total_max_rate);
	ret = iavf_validate_tx_bandwidth(adapter, total_max_rate);
	return ret;
	return ret;
Loading