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: dg573847...@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.