Commit bd67a8c1 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Release connector iterator on a digital port conflict.

Hitting the failure path through check_digital_port_conflicts triggers:

================================================
WARNING: lock held when returning to user space!
4.16.0-rc1-CI-kasan_1+ #1 Tainted: G        W
------------------------------------------------
kms_3d/1439 is leaving the kernel with locks still held!
1 lock held by kms_3d/1439:
 #0:  (drm_connector_list_iter){.+.+}, at: [<000000003745d183>] intel_atomic_check+0x1d9d/0x3ff0 [i915]

Rearrange the code to have a single exit path through the unlock.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reported-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180215091425.42364-1-maarten.lankhorst@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent d081e021
...@@ -10705,6 +10705,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) ...@@ -10705,6 +10705,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
struct drm_connector_list_iter conn_iter; struct drm_connector_list_iter conn_iter;
unsigned int used_ports = 0; unsigned int used_ports = 0;
unsigned int used_mst_ports = 0; unsigned int used_mst_ports = 0;
bool ret = true;
/* /*
* Walk the connector list instead of the encoder * Walk the connector list instead of the encoder
...@@ -10739,7 +10740,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) ...@@ -10739,7 +10740,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
/* the same port mustn't appear more than once */ /* the same port mustn't appear more than once */
if (used_ports & port_mask) if (used_ports & port_mask)
return false; ret = false;
used_ports |= port_mask; used_ports |= port_mask;
break; break;
...@@ -10757,7 +10758,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) ...@@ -10757,7 +10758,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
if (used_ports & used_mst_ports) if (used_ports & used_mst_ports)
return false; return false;
return true; return ret;
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment