]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/dp: Ensure max link params are always valid
authorImre Deak <imre.deak@intel.com>
Mon, 18 Oct 2021 09:41:51 +0000 (12:41 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Nov 2021 08:49:05 +0000 (09:49 +0100)
commit109653f65a17205a5f48f16ed8631e7246b061c4
tree23cf20ae7ba4be9af56fb81985b0833c83aa5a51
parent75533d6d48b182802c296c4b8b35d8ab0a8c74b3
drm/i915/dp: Ensure max link params are always valid

commit f757cb6b1f9216d1eaa2a1a674188fe66d3dcde8 upstream.

Atm until the DPCD for a connector is read the max link rate and lane
count params are invalid. If the connector is modeset, in
intel_dp_compute_config(), intel_dp_common_len_rate_limit(max_link_rate)
will return 0, leading to a intel_dp->common_rates[-1] access.

Fix the above by making sure the max link params are always valid.

The above access leads to an undefined behaviour by definition, though
not causing a user visible problem to my best knowledge, see the previous
patch why. Nevertheless it is an undefined behaviour and it triggers a
BUG() in CONFIG_UBSAN builds, hence CC:stable.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211018094154.1407705-4-imre.deak@intel.com
(cherry picked from commit 032d5d20be625b7de7d75e62fe13560c9e2629a3)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/display/intel_dp.c