numam-dpdk/drivers/net/axgbe
Pallantla Poornima c8c2296b59 net/axgbe: fix double unlock
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: a5c7273771 ("net/axgbe: add phy programming APIs")
Cc: stable@dpdk.org

Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
2019-10-23 16:43:10 +02:00
..
axgbe_common.h drivers/net: fix shifting 32-bit signed variable 31 times 2019-03-01 18:17:36 +01:00
axgbe_dev.c net: add rte prefix to ether defines 2019-05-24 13:34:45 +02:00
axgbe_ethdev.c ethdev: change allmulticast callbacks to return status 2019-10-07 15:00:55 +02:00
axgbe_ethdev.h net: add rte prefix to ether defines 2019-05-24 13:34:45 +02:00
axgbe_i2c.c net/axgbe: add phy init and related APIs 2018-04-14 00:41:44 +02:00
axgbe_logs.h net/axgbe: add minimal init and uninit support 2018-04-14 00:41:44 +02:00
axgbe_mdio.c net/axgbe: add workaround for ethernet training 2018-04-14 00:41:44 +02:00
axgbe_phy_impl.c net/axgbe: fix double unlock 2019-10-23 16:43:10 +02:00
axgbe_phy.h net/axgbe: add phy register map and helper macros 2018-04-14 00:41:44 +02:00
axgbe_rxtx_vec_sse.c net/axgbe: add Rx/Tx data path 2018-04-14 00:41:44 +02:00
axgbe_rxtx.c net/axgbe: remove unnecessary cast 2019-06-13 23:54:29 +09:00
axgbe_rxtx.h net/axgbe: fix incorrect cache alignment macro 2018-04-27 15:54:56 +01:00
Makefile drivers/net: use ack in interrupt handlers 2019-07-23 12:00:23 +02:00
meson.build drivers/net: use ack in interrupt handlers 2019-07-23 12:00:23 +02:00
rte_pmd_axgbe_version.map fix indentation in symbol maps 2018-11-26 20:16:46 +01:00