From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Satyeshwar Singh Date: Sun, 14 Oct 2018 16:41:07 -0700 Subject: [PATCH] drm/i915: Check for a valid fb when computing watermarks fb must be valid when we are computing watermarks for a plane or else we will run into a crash. Checking to see if it is indeed valid and returning EINVAL if it's not. https://github.com/projectacrn/acrn-hypervisor/issues/1459 Signed-off-by: Satyeshwar Singh Reviewed-by: Zhao Yakui --- drivers/gpu/drm/i915/intel_pm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 968ac86159f2..54979509e44c 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -4554,6 +4554,11 @@ skl_compute_plane_wm_params(const struct drm_i915_private *dev_priv, if (!intel_wm_plane_visible(cstate, intel_pstate)) return 0; + if (plane_id == 1 && !fb) { + DRM_DEBUG_KMS("Invalid fb for plane\n"); + return -EINVAL; + } + /* only NV12 format has two planes */ if (plane_id == 1 && fb->format->format != DRM_FORMAT_NV12) { DRM_DEBUG_KMS("Non NV12 format have single plane\n"); -- https://clearlinux.org