[PATCH 4.19 195/205] drm/i915: Fix error handling for the NV12 fb dimensions check

From: Greg Kroah-Hartman
Date: Mon Nov 19 2018 - 11:38:46 EST


4.19-stable review patch. If anyone has any objections, please let me know.

------------------

From: Ville SyrjÃlà <ville.syrjala@xxxxxxxxxxxxxxx>

commit f42f343887016330b321dd40eebc68c7292e4f1b upstream.

Let's not leak obj->framebuffer_references when we decide that
the framebuffer domensions are not suitable for NV12.

Cc: stable@xxxxxxxxxxxxxxx
Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Cc: Vidya Srinivas <vidya.srinivas@xxxxxxxxx>
Fixes: e44134f2673c ("drm/i915: Add NV12 support to intel_framebuffer_init")
Signed-off-by: Ville SyrjÃlà <ville.syrjala@xxxxxxxxxxxxxxx>
Link: https://patchwork.freedesktop.org/patch/msgid/20181029140031.11765-1-ville.syrjala@xxxxxxxxxxxxxxx
Reviewed-by: Matt Roper <matthew.d.roper@xxxxxxxxx>
(cherry picked from commit 3b90946fcb6f13b65888c380461793a9dea9d1f4)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/i915/intel_display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14582,7 +14582,7 @@ static int intel_framebuffer_init(struct
fb->height < SKL_MIN_YUV_420_SRC_H ||
(fb->width % 4) != 0 || (fb->height % 4) != 0)) {
DRM_DEBUG_KMS("src dimensions not correct for NV12\n");
- return -EINVAL;
+ goto err;
}

for (i = 0; i < fb->format->num_planes; i++) {