DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [dpdk-dev] [Bug 776] Potential error(e.g., resource leak, deadlock) due to the unreleased lock pdata->phy_mutex
Date: Wed, 04 Aug 2021 17:01:29 +0000	[thread overview]
Message-ID: <bug-776-3@http.bugs.dpdk.org/> (raw)

https://bugs.dpdk.org/show_bug.cgi?id=776

            Bug ID: 776
           Summary: Potential error(e.g., resource leak, deadlock) due to
                    the unreleased lock pdata->phy_mutex
           Product: DPDK
           Version: 20.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: ethdev
          Assignee: dev@dpdk.org
          Reporter: dg573847474@gmail.com
  Target Milestone: ---

source:
f-stack/dpdk/drivers/net/axgbe/axgbe_phy_impl.c

Hi, developers, thank you for your checking. The lock pdata->phy_mutex may not
be correctly released if the phy_data->comm_owned is true and the control flow
goes to the branch listed below. Finally, the method returns with the
unreleased lock. The fix is to insert pthread_mutex_unlock(&pdata->phy_mutex);
before returning.

static int axgbe_phy_get_comm_ownership(struct axgbe_port *pdata)
{
        struct axgbe_phy_data *phy_data = pdata->phy_data;
        uint64_t timeout;
        unsigned int mutex_id;

        /* The I2C and MDIO/GPIO bus is multiplexed between multiple devices,
         * the driver needs to take the software mutex and then the hardware
         * mutexes before being able to use the busses.
         */
        pthread_mutex_lock(&pdata->phy_mutex);

        if (phy_data->comm_owned)
                return 0;  // the method returns with the unreleased lock

        ...;
        return -ETIMEDOUT;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2021-08-04 17:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-776-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@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).