Commit 110eff17 authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Jakub Kicinski
Browse files

eth: bnxt: switch to netif_close



All (error) paths that call dev_close are already holding instance lock,
so switch to netif_close to avoid the deadlock.

v2:
- add missing EXPORT_MODULE for netif_close

Fixes: 004b5008 ("eth: bnxt: remove most dependencies on RTNL")
Reported-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarStanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250309215851.2003708-1-sdf@fomichev.me


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0a13c1e0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -12802,7 +12802,7 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
		rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
	if (rc) {
		netdev_err(bp->dev, "nic open fail (rc: %x)\n", rc);
		dev_close(bp->dev);
		netif_close(bp->dev);
	}
	return rc;
}
@@ -12840,7 +12840,7 @@ int bnxt_half_open_nic(struct bnxt *bp)
half_open_err:
	bnxt_free_skbs(bp);
	bnxt_free_mem(bp, true);
	dev_close(bp->dev);
	netif_close(bp->dev);
	return rc;
}

@@ -14195,7 +14195,7 @@ void bnxt_fw_reset(struct bnxt *bp)
			netdev_err(bp->dev, "Firmware reset aborted, rc = %d\n",
				   n);
			clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
			dev_close(bp->dev);
			netif_close(bp->dev);
			goto fw_reset_exit;
		} else if (n > 0) {
			u16 vf_tmo_dsecs = n * 10;
@@ -14810,7 +14810,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
	if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
		bnxt_dl_health_fw_status_update(bp, false);
	bp->fw_reset_state = 0;
	dev_close(bp->dev);
	netif_close(bp->dev);
}

static void bnxt_fw_reset_task(struct work_struct *work)
@@ -16276,7 +16276,7 @@ int bnxt_restore_pf_fw_resources(struct bnxt *bp)

	if (netif_running(bp->dev)) {
		if (rc)
			dev_close(bp->dev);
			netif_close(bp->dev);
		else
			rc = bnxt_open_nic(bp, true, false);
	}
@@ -16669,7 +16669,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
		goto shutdown_exit;

	if (netif_running(dev))
		dev_close(dev);
		netif_close(dev);

	bnxt_ptp_clear(bp);
	bnxt_clear_int_mode(bp);
+2 −2
Original line number Diff line number Diff line
@@ -461,7 +461,7 @@ static int bnxt_dl_reload_down(struct devlink *dl, bool netns_change,
		if (rc) {
			NL_SET_ERR_MSG_MOD(extack, "Failed to deregister");
			if (netif_running(bp->dev))
				dev_close(bp->dev);
				netif_close(bp->dev);
			netdev_unlock(bp->dev);
			rtnl_unlock();
			break;
@@ -576,7 +576,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
		*actions_performed |= BIT(action);
	} else if (netif_running(bp->dev)) {
		netdev_lock(bp->dev);
		dev_close(bp->dev);
		netif_close(bp->dev);
		netdev_unlock(bp->dev);
	}
	rtnl_unlock();
+1 −0
Original line number Diff line number Diff line
@@ -1760,6 +1760,7 @@ void netif_close(struct net_device *dev)
		list_del(&single);
	}
}
EXPORT_SYMBOL(netif_close);

void netif_disable_lro(struct net_device *dev)
{