From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Drew Davenport <ddavenport@chromium.org>
Cc: intel-gfx@lists.freedesktop.org,
"Daniel Vetter" <daniel@ffwll.ch>,
"David Airlie" <airlied@gmail.com>,
"Imre Deak" <imre.deak@intel.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"José Roberto de Souza" <jose.souza@intel.com>,
"Juha-Pekka Heikkilä" <juha-pekka.heikkila@intel.com>,
"Matt Roper" <matthew.d.roper@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/i915/display: Check source height is > 0
Date: Thu, 12 Jan 2023 20:28:35 +0200 [thread overview]
Message-ID: <Y8BRUwiznxA/tns7@intel.com> (raw)
In-Reply-To: <20221226225246.1.I15dff7bb5a0e485c862eae61a69096caf12ef29f@changeid>
On Mon, Dec 26, 2022 at 10:53:24PM -0700, Drew Davenport wrote:
> The error message suggests that the height of the src rect must be at
> least 1. Reject source with height of 0.
>
> Signed-off-by: Drew Davenport <ddavenport@chromium.org>
>
> ---
> I was investigating some divide-by-zero crash reports on ChromeOS which
> pointed to the intel_adjusted_rate function. Further prodding showed
> that I could reproduce this in a simple test program if I made src_h
> some value less than 1 but greater than 0.
>
> This seemed to be a sensible place to check that the source height is at
> least 1. I tried to repro this issue on an amd device I had on hand, and
> the configuration was rejected.
>
> Would it make sense to add a check that source dimensions are at least 1
> somewhere in core, like in drm_atomic_plane_check? Or is that a valid
> use case on some devices, and thus any such check should be done on a
> per-driver basis?
>
> Thanks.
>
> drivers/gpu/drm/i915/display/skl_universal_plane.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index 4b79c2d2d6177..9b172a1e90deb 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -1627,7 +1627,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
> u32 offset;
> int ret;
>
> - if (w > max_width || w < min_width || h > max_height) {
> + if (w > max_width || w < min_width || h > max_height || h < 1) {
I liked this one best so pushed to drm-intel-next with cc:stable. Thanks.
In the future we might want to move some of these checks to an earlier
spot to make sure we don't hit any other weird issues in some other
code, but for the moment I think this will do.
> drm_dbg_kms(&dev_priv->drm,
> "requested Y/RGB source size %dx%d outside limits (min: %dx1 max: %dx%d)\n",
> w, h, min_width, max_width, max_height);
> --
> 2.39.0.314.g84b9a713c41-goog
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-01-12 18:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 5:53 [PATCH] drm/i915/display: Check source height is > 0 Drew Davenport
2022-12-27 17:55 ` [Intel-gfx] " Teres Alexis, Alan Previn
2023-01-11 18:47 ` Drew Davenport
2023-01-03 10:42 ` Juha-Pekka Heikkila
2023-01-10 20:30 ` Drew Davenport
2023-01-12 18:28 ` Ville Syrjälä [this message]
2023-01-13 11:06 ` [Intel-gfx] " Juha-Pekka Heikkila
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y8BRUwiznxA/tns7@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=ddavenport@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=jose.souza@intel.com \
--cc=juha-pekka.heikkila@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.d.roper@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox