[dpdk-dev] [Bug 776] Potential error(e.g., resource leak, deadlock) due to the unreleased lock pdata->phy_mutex

bugzilla at dpdk.org bugzilla at dpdk.org
Wed Aug 4 19:01:29 CEST 2021


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 at dpdk.org
          Reporter: dg573847474 at 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.


More information about the dev mailing list