From: Ferruh Yigit <ferruh.yigit@intel.com>
To: "Kumar, Ravi1" <Ravi1.Kumar@amd.com>,
Pallantla Poornima <pallantlax.poornima@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "reshma.pattan@intel.com" <reshma.pattan@intel.com>,
"jananeex.m.parthasarathy@intel.com"
<jananeex.m.parthasarathy@intel.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/axgbe: fix double unlock coverity issue
Date: Mon, 21 Oct 2019 10:09:30 +0100 [thread overview]
Message-ID: <f1766732-32af-f6ce-5a6b-adac624fea41@intel.com> (raw)
In-Reply-To: <MW2PR12MB25706CDAD4A0EF69AA031EF8AE690@MW2PR12MB2570.namprd12.prod.outlook.com>
On 10/21/2019 9:20 AM, Kumar, Ravi1 wrote:
>> On 10/9/2019 9:41 AM, Ferruh Yigit wrote:
>>> On 9/19/2019 12:01 PM, Pallantla Poornima wrote:
>>>> 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>
>>>
>>> lgtm, 'axgbe_phy_put_comm_ownership()' expects 'axgbe_phy_get_comm_ownership()'
>>> gets the lock. Thanks for fixing the coverity issue.
>>>
>>> But still, Ravi can you please review/test the patch?
>>>
>>
>> If there is no objection the patch will be merged soon.
>>
> Looks good to me. Ok to merge.
(Converting to explicit Ack)
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
Applied to dpdk-next-net/master, thanks.
prev parent reply other threads:[~2019-10-21 9:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 11:01 [dpdk-stable] " Pallantla Poornima
2019-09-25 6:03 ` Poornima, PallantlaX
2019-10-09 8:41 ` Ferruh Yigit
2019-10-18 16:53 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
2019-10-21 8:20 ` Kumar, Ravi1
2019-10-21 9:09 ` Ferruh Yigit [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1766732-32af-f6ce-5a6b-adac624fea41@intel.com \
--to=ferruh.yigit@intel.com \
--cc=Ravi1.Kumar@amd.com \
--cc=dev@dpdk.org \
--cc=jananeex.m.parthasarathy@intel.com \
--cc=pallantlax.poornima@intel.com \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).