Commit c60e7877 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2025-04-29 (idpf, igc)

For idpf:
Michal fixes error path handling to remove memory leak.

Larysa prevents reset from being called during shutdown.

For igc:
Jake adjusts locking order to resolve sleeping in atomic context.

* '200GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue:
  igc: fix lock order in igc_ptp_reset
  idpf: protect shutdown from reset
  idpf: fix potential memory leak on kcalloc() failure
====================

Link: https://patch.msgid.link/20250429221034.3909139-1-anthony.l.nguyen@intel.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 34f42736 c7d6cb96
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -1113,11 +1113,9 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,

	num_max_q = max(max_q->max_txq, max_q->max_rxq);
	vport->q_vector_idxs = kcalloc(num_max_q, sizeof(u16), GFP_KERNEL);
	if (!vport->q_vector_idxs) {
		kfree(vport);
	if (!vport->q_vector_idxs)
		goto free_vport;

		return NULL;
	}
	idpf_vport_init(vport, max_q);

	/* This alloc is done separate from the LUT because it's not strictly
@@ -1127,11 +1125,9 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
	 */
	rss_data = &adapter->vport_config[idx]->user_config.rss_data;
	rss_data->rss_key = kzalloc(rss_data->rss_key_size, GFP_KERNEL);
	if (!rss_data->rss_key) {
		kfree(vport);
	if (!rss_data->rss_key)
		goto free_vector_idxs;

		return NULL;
	}
	/* Initialize default rss key */
	netdev_rss_key_fill((void *)rss_data->rss_key, rss_data->rss_key_size);

@@ -1144,6 +1140,13 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
	adapter->next_vport = idpf_get_free_slot(adapter);

	return vport;

free_vector_idxs:
	kfree(vport->q_vector_idxs);
free_vport:
	kfree(vport);

	return NULL;
}

/**
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ static void idpf_shutdown(struct pci_dev *pdev)
{
	struct idpf_adapter *adapter = pci_get_drvdata(pdev);

	cancel_delayed_work_sync(&adapter->serv_task);
	cancel_delayed_work_sync(&adapter->vc_event_task);
	idpf_vc_core_deinit(adapter);
	idpf_deinit_dflt_mbx(adapter);
+4 −2
Original line number Diff line number Diff line
@@ -1290,6 +1290,8 @@ void igc_ptp_reset(struct igc_adapter *adapter)
	/* reset the tstamp_config */
	igc_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config);

	mutex_lock(&adapter->ptm_lock);

	spin_lock_irqsave(&adapter->tmreg_lock, flags);

	switch (adapter->hw.mac.type) {
@@ -1308,7 +1310,6 @@ void igc_ptp_reset(struct igc_adapter *adapter)
		if (!igc_is_crosststamp_supported(adapter))
			break;

		mutex_lock(&adapter->ptm_lock);
		wr32(IGC_PCIE_DIG_DELAY, IGC_PCIE_DIG_DELAY_DEFAULT);
		wr32(IGC_PCIE_PHY_DELAY, IGC_PCIE_PHY_DELAY_DEFAULT);

@@ -1332,7 +1333,6 @@ void igc_ptp_reset(struct igc_adapter *adapter)
			netdev_err(adapter->netdev, "Timeout reading IGC_PTM_STAT register\n");

		igc_ptm_reset(hw);
		mutex_unlock(&adapter->ptm_lock);
		break;
	default:
		/* No work to do. */
@@ -1349,5 +1349,7 @@ void igc_ptp_reset(struct igc_adapter *adapter)
out:
	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);

	mutex_unlock(&adapter->ptm_lock);

	wrfl();
}