c8c2296b59
One issue caught by Coverity 340835
*unlock: axgbe_phy_set_mode unlocks pdata->phy_mutex
*double_unlock: axgbe_phy_sfp_detect unlocks pdata->phy_mutex
while it is unlocked.
In axgbe_phy_sfp_detect()/axgbe_phy_set_redrv_mode(),
axgbe_phy_get_comm_ownership() and axgbe_phy_put_comm_ownership()
are invoked subsequently.
Currently in axgbe_phy_get_comm_ownership(), during one of the case
'phy_data->comm_owned' is not protected and before returning 0, lock is
not called and unlock is called in axgbe_phy_put_comm_ownership()
directly which is incorrect.
Ideally, the variable 'phy_data->comm_owned' needs to be protected.
During success scenario, lock is called in
axgbe_phy_get_comm_ownership() followed by unlock in
axgbe_phy_put_comm_ownership(). In failure case, unlock is invoked in
axgbe_phy_get_comm_ownership() itself appropriately.
The fix is to protect 'phy_data->comm_owned' in the identified case
ensuring locks/unlocks properly exist.
Coverity issue: 340835
Fixes:
|
||
---|---|---|
.. | ||
axgbe_common.h | ||
axgbe_dev.c | ||
axgbe_ethdev.c | ||
axgbe_ethdev.h | ||
axgbe_i2c.c | ||
axgbe_logs.h | ||
axgbe_mdio.c | ||
axgbe_phy_impl.c | ||
axgbe_phy.h | ||
axgbe_rxtx_vec_sse.c | ||
axgbe_rxtx.c | ||
axgbe_rxtx.h | ||
Makefile | ||
meson.build | ||
rte_pmd_axgbe_version.map |