stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Don't oops in dumb_create ioctl if we have no crtcs
@ 2019-11-06 17:23 Ville Syrjala
  2019-11-06 17:38 ` [Intel-gfx] " Chris Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Ville Syrjala @ 2019-11-06 17:23 UTC (permalink / raw)
  To: intel-gfx; +Cc: stable, Mika Kuoppala

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make sure we have a crtc before probing its primary plane's
max stride. Initially I thought we can't get this far without
crtcs, but looks like we can via the dumb_create ioctl.

Not sure if we shouldn't disable dumb buffer support entirely
when we have no crtcs, but that would require some amount of work
as the only thing currently being checked is dev->driver->dumb_create
which we'd have to convert to some device specific dynamic thing.

Cc: stable@vger.kernel.org
Reported-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Fixes: aa5ca8b7421c ("drm/i915: Align dumb buffer stride to 4k to allow for gtt remapping")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 1f93860fb897..331030765ca9 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2543,6 +2543,9 @@ u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
 	 * the highest stride limits of them all.
 	 */
 	crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
+	if (!crtc)
+		return 0;
+
 	plane = to_intel_plane(crtc->base.primary);
 
 	return plane->max_stride(plane, pixel_format, modifier,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915: Don't oops in dumb_create ioctl if we have no crtcs
  2019-11-06 17:23 [PATCH] drm/i915: Don't oops in dumb_create ioctl if we have no crtcs Ville Syrjala
@ 2019-11-06 17:38 ` Chris Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wilson @ 2019-11-06 17:38 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx; +Cc: stable

Quoting Ville Syrjala (2019-11-06 17:23:49)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Make sure we have a crtc before probing its primary plane's
> max stride. Initially I thought we can't get this far without
> crtcs, but looks like we can via the dumb_create ioctl.
> 
> Not sure if we shouldn't disable dumb buffer support entirely
> when we have no crtcs, but that would require some amount of work
> as the only thing currently being checked is dev->driver->dumb_create
> which we'd have to convert to some device specific dynamic thing.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Fixes: aa5ca8b7421c ("drm/i915: Align dumb buffer stride to 4k to allow for gtt remapping")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 1f93860fb897..331030765ca9 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2543,6 +2543,9 @@ u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
>          * the highest stride limits of them all.
>          */
>         crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
> +       if (!crtc)
> +               return 0;
> +

Callers:
intel_fb_max_stride -> intel_framebuffer_init, not used if no display
intel_fb_stride_alignment,
	0 -> intel_tile_size() alignment. ok ->
	intel_framebuffer_init, not used as no display

-> i915_gem_dumb_create -> args->pitch = PAGE_ALIGN()

Ok, not as horrible as I feared when I saw return 0 from max_stride!

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-06 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 17:23 [PATCH] drm/i915: Don't oops in dumb_create ioctl if we have no crtcs Ville Syrjala
2019-11-06 17:38 ` [Intel-gfx] " Chris Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).