diff options
author | Adam Richter <adamrichter4@gmail.com> | 2015-10-16 06:33:02 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-10-21 18:29:08 -0400 |
commit | 30730c7f5943b3beace1e29f7f1476e05de3da14 (patch) | |
tree | 2420503336aa1afaca73ad9be3b06e79e9aef407 | |
parent | 1099f86044111e9a7807f09523e42d4c9d0fb781 (diff) |
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.
[airlied: grabbed from drm-next as it fixes something we've seen]
Signed-off-by: Adam J. Richter <adam_richter2004@yahoo.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_dp_mst_topology.c | 7 |
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 5bca390d9ae2..809959d56d78 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | |||
@@ -1194,17 +1194,18 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ | |||
1194 | 1194 | ||
1195 | list_for_each_entry(port, &mstb->ports, next) { | 1195 | list_for_each_entry(port, &mstb->ports, next) { |
1196 | if (port->port_num == port_num) { | 1196 | if (port->port_num == port_num) { |
1197 | if (!port->mstb) { | 1197 | mstb = port->mstb; |
1198 | if (!mstb) { | ||
1198 | DRM_ERROR("failed to lookup MSTB with lct %d, rad %02x\n", lct, rad[0]); | 1199 | DRM_ERROR("failed to lookup MSTB with lct %d, rad %02x\n", lct, rad[0]); |
1199 | return NULL; | 1200 | goto out; |
1200 | } | 1201 | } |
1201 | 1202 | ||
1202 | mstb = port->mstb; | ||
1203 | break; | 1203 | break; |
1204 | } | 1204 | } |
1205 | } | 1205 | } |
1206 | } | 1206 | } |
1207 | kref_get(&mstb->kref); | 1207 | kref_get(&mstb->kref); |
1208 | out: | ||
1208 | mutex_unlock(&mgr->lock); | 1209 | mutex_unlock(&mgr->lock); |
1209 | return mstb; | 1210 | return mstb; |
1210 | } | 1211 | } |