DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [Bug 776] Potential error(e.g., resource leak, deadlock) due to the unreleased lock pdata->phy_mutex
@ 2021-08-04 17:01 bugzilla
  0 siblings, 0 replies; only message in thread
From: bugzilla @ 2021-08-04 17:01 UTC (permalink / raw)
  To: dev

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-04 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 17:01 [dpdk-dev] [Bug 776] Potential error(e.g., resource leak, deadlock) due to the unreleased lock pdata->phy_mutex bugzilla

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).