[dpdk-dev] [PATCH] net/axgbe: fix double unlock coverity issue

Poornima, PallantlaX pallantlax.poornima at intel.com
Wed Sep 25 08:03:38 CEST 2019


>-----Original Message-----
>From: Poornima, PallantlaX
>Sent: Thursday, September 19, 2019 4:32 PM
>To: dev at dpdk.org
>Cc: Pattan, Reshma <reshma.pattan at intel.com>; Parthasarathy, JananeeX M
><jananeex.m.parthasarathy at intel.com>; ravi1.kumar at amd.com; Poornima,
>PallantlaX <pallantlax.poornima at intel.com>; stable at dpdk.org
>Subject: [PATCH] net/axgbe: fix double unlock coverity issue
>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
>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
>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 at dpdk.org
>Signed-off-by: Pallantla Poornima <pallantlax.poornima at intel.com>
> drivers/net/axgbe/axgbe_phy_impl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

Request for review.


More information about the dev mailing list