Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 470a5420 authored by Bruce Allan's avatar Bruce Allan Committed by Jeff Kirsher
Browse files

e1000e: test for valid check_reset_block function pointer



commit 44abd5c1 introduced NULL pointer
dereferences when attempting to access the check_reset_block function
pointer on 8257x and 80003es2lan non-copper devices.

This fix should be applied back through 3.4.

Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Tested-by: default avatarJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent dc5cd894
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -258,7 +258,8 @@ static int e1000_set_settings(struct net_device *netdev,
	 * When SoL/IDER sessions are active, autoneg/speed/duplex
	 * cannot be changed
	 */
	if (hw->phy.ops.check_reset_block(hw)) {
	if (hw->phy.ops.check_reset_block &&
	    hw->phy.ops.check_reset_block(hw)) {
		e_err("Cannot change link characteristics when SoL/IDER is active.\n");
		return -EINVAL;
	}
@@ -1615,7 +1616,8 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
	 * PHY loopback cannot be performed if SoL/IDER
	 * sessions are active
	 */
	if (hw->phy.ops.check_reset_block(hw)) {
	if (hw->phy.ops.check_reset_block &&
	    hw->phy.ops.check_reset_block(hw)) {
		e_err("Cannot do PHY loopback test when SoL/IDER is active.\n");
		*data = 0;
		goto out;
+1 −1
Original line number Diff line number Diff line
@@ -709,7 +709,7 @@ s32 e1000e_setup_link_generic(struct e1000_hw *hw)
	 * In the case of the phy reset being blocked, we already have a link.
	 * We do not need to set it up again.
	 */
	if (hw->phy.ops.check_reset_block(hw))
	if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw))
		return 0;

	/*
+2 −2
Original line number Diff line number Diff line
@@ -6237,7 +6237,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
		adapter->hw.phy.ms_type = e1000_ms_hw_default;
	}

	if (hw->phy.ops.check_reset_block(hw))
	if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw))
		e_info("PHY reset is blocked due to SOL/IDER session.\n");

	/* Set initial default active device features */
@@ -6404,7 +6404,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
	if (!(adapter->flags & FLAG_HAS_AMT))
		e1000e_release_hw_control(adapter);
err_eeprom:
	if (!hw->phy.ops.check_reset_block(hw))
	if (hw->phy.ops.check_reset_block && !hw->phy.ops.check_reset_block(hw))
		e1000_phy_hw_reset(&adapter->hw);
err_hw_init:
	kfree(adapter->tx_ring);
+5 −3
Original line number Diff line number Diff line
@@ -2155,9 +2155,11 @@ s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw)
	s32 ret_val;
	u32 ctrl;

	if (phy->ops.check_reset_block) {
		ret_val = phy->ops.check_reset_block(hw);
		if (ret_val)
			return 0;
	}

	ret_val = phy->ops.acquire(hw);
	if (ret_val)