[dpdk-dev] [Bug 777] Potential error(e.g., resource leak, deadlock) due to the unreleased lock pdata->i2c_mutex
bugzilla at dpdk.org
bugzilla at dpdk.org
Wed Aug 4 19:03:27 CEST 2021
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 at dpdk.org
Reporter: dg573847474 at 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.
More information about the dev
mailing list