summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAdam Richter <adamrichter4@gmail.com>2015-10-16 10:33:02 (GMT)
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-10-19 09:00:47 (GMT)
commit6749c9f023d49adca3ca4773e93282b95ceebfb5 (patch)
tree18ed5e6eaa1033902742b0a636ecfca771ce168a /drivers
parent2afa701d3e0bb9865130990b5e0cfe240ae3b605 (diff)
downloadlinux-6749c9f023d49adca3ca4773e93282b95ceebfb5.tar.xz
drm: fix mutex leak in drm_dp_get_mst_branch_device
In Linux 4.3-rc5, there is an error case in drm_dp_get_branch_device that returns without releasing mgr->lock, resulting a spew of kernel messages about a kernel work function possibly having leaked a mutex and presumably more serious adverse consequences later. This patch changes the error to "goto out" to unlock the mutex before returning. Signed-off-by: Adam J. Richter <adam_richter2004@yahoo.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index e23df5f..e4c9b4a 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1182,17 +1182,18 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_
list_for_each_entry(port, &mstb->ports, next) {
if (port->port_num == port_num) {
- if (!port->mstb) {
+ mstb = port->mstb;
+ if (!mstb) {
DRM_ERROR("failed to lookup MSTB with lct %d, rad %02x\n", lct, rad[0]);
- return NULL;
+ goto out;
}
- mstb = port->mstb;
break;
}
}
}
kref_get(&mstb->kref);
+out:
mutex_unlock(&mgr->lock);
return mstb;
}