Skip to content

Commit c60e787

Browse files
committed
Merge branch '200GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
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: Jakub Kicinski <kuba@kernel.org>
2 parents 34f4273 + c7d6cb9 commit c60e787

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

drivers/net/ethernet/intel/idpf/idpf_lib.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,11 +1113,9 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
11131113

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

1119-
return NULL;
1120-
}
11211119
idpf_vport_init(vport, max_q);
11221120

11231121
/* 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,
11271125
*/
11281126
rss_data = &adapter->vport_config[idx]->user_config.rss_data;
11291127
rss_data->rss_key = kzalloc(rss_data->rss_key_size, GFP_KERNEL);
1130-
if (!rss_data->rss_key) {
1131-
kfree(vport);
1128+
if (!rss_data->rss_key)
1129+
goto free_vector_idxs;
11321130

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

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

11461142
return vport;
1143+
1144+
free_vector_idxs:
1145+
kfree(vport->q_vector_idxs);
1146+
free_vport:
1147+
kfree(vport);
1148+
1149+
return NULL;
11471150
}
11481151

11491152
/**

drivers/net/ethernet/intel/idpf/idpf_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static void idpf_shutdown(struct pci_dev *pdev)
8989
{
9090
struct idpf_adapter *adapter = pci_get_drvdata(pdev);
9191

92+
cancel_delayed_work_sync(&adapter->serv_task);
9293
cancel_delayed_work_sync(&adapter->vc_event_task);
9394
idpf_vc_core_deinit(adapter);
9495
idpf_deinit_dflt_mbx(adapter);

drivers/net/ethernet/intel/igc/igc_ptp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,8 @@ void igc_ptp_reset(struct igc_adapter *adapter)
12901290
/* reset the tstamp_config */
12911291
igc_ptp_set_timestamp_mode(adapter, &adapter->tstamp_config);
12921292

1293+
mutex_lock(&adapter->ptm_lock);
1294+
12931295
spin_lock_irqsave(&adapter->tmreg_lock, flags);
12941296

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

1311-
mutex_lock(&adapter->ptm_lock);
13121313
wr32(IGC_PCIE_DIG_DELAY, IGC_PCIE_DIG_DELAY_DEFAULT);
13131314
wr32(IGC_PCIE_PHY_DELAY, IGC_PCIE_PHY_DELAY_DEFAULT);
13141315

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

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

1352+
mutex_unlock(&adapter->ptm_lock);
1353+
13521354
wrfl();
13531355
}

0 commit comments

Comments
 (0)