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

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

            Bug ID: 777
           Summary: Potential error(e.g., resource leak, deadlock) due to
                    the unreleased lock pdata->i2c_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:
drivers/net/axgbe/axgbe_i2c.c

Hi, developers, thank you for your checking. The lock &pdata->i2c_mutex may not
be correctly released if the ret==1 and control flow goes to these two branches
listed below. Finally, the method returns with the unreleased lock. The fix is
to insert pthread_mutex_unlock(&pdata->i2c_mutex); before returning.


static int axgbe_i2c_xfer(struct axgbe_port *pdata, struct axgbe_i2c_op *op)
{
        ...;
        pthread_mutex_lock(&pdata->i2c_mutex);
        ret = axgbe_i2c_disable(pdata);
        if (ret) {
                PMD_DRV_LOG(ERR, "failed to disable i2c master\n");
                return ret; // the method returns with unreleased lock
        }

        ...;
        ret = axgbe_i2c_enable(pdata);
        if (ret) {
                PMD_DRV_LOG(ERR, "failed to enable i2c master\n");
                return ret; // the method returns with unreleased lock
        }

        ...;
}

-- 
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:03 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:03 [dpdk-dev] [Bug 777] Potential error(e.g., resource leak, deadlock) due to the unreleased lock pdata->i2c_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).