提交 7ae76a44 编写于 作者: J Jeff Kirsher 提交者: Xie XiuQi

e1000e: fix a missing check for return value

mainline inclusion
from mainline-5.0
commit 979eff22c9f4
category: bugfix
bugzilla: 11369
CVE: NA

-------------------------------------------------

The change is based on the issue found by Kangjie Lu <kjlu@umn.edu> where
we not checking the return value of a register read/write which could result
in a NULL pointer dereference if the read/write fails.

Since we are only trying to disable the far-end loopback, if the read
and write of register fails, we do not want to bail out of the function.
We just want to log that it failed to disable and continue on.

CC: Sasha Neftin <sasha.neftin@intel.com>
CC: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: NAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NZhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: NWenan Mao <maowenan@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 cf9a800e
...@@ -696,11 +696,16 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw) ...@@ -696,11 +696,16 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
ret_val = ret_val =
e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
&kum_reg_data); &kum_reg_data);
if (ret_val) if (!ret_val) {
return ret_val; kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE; ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data); kum_reg_data);
if (ret_val)
e_dbg("Error disabling far-end loopback\n");
} else {
e_dbg("Error disabling far-end loopback\n");
}
ret_val = e1000e_get_auto_rd_done(hw); ret_val = e1000e_get_auto_rd_done(hw);
if (ret_val) if (ret_val)
...@@ -754,11 +759,19 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw) ...@@ -754,11 +759,19 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
return ret_val; return ret_val;
/* Disable IBIST slave mode (far-end loopback) */ /* Disable IBIST slave mode (far-end loopback) */
e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, ret_val =
&kum_reg_data); e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE; &kum_reg_data);
e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, if (!ret_val) {
kum_reg_data); kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
E1000_KMRNCTRLSTA_INBAND_PARAM,
kum_reg_data);
if (ret_val)
e_dbg("Error disabling far-end loopback\n");
} else {
e_dbg("Error disabling far-end loopback\n");
}
/* Set the transmit descriptor write-back policy */ /* Set the transmit descriptor write-back policy */
reg_data = er32(TXDCTL(0)); reg_data = er32(TXDCTL(0));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册