public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: David Weinehall <david.weinehall@linux.intel.com>
To: Antti Koskipaa <antti.koskipaa@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Allow parsing of variable size child device entries from VBT
Date: Fri, 10 Jul 2015 15:32:11 +0300	[thread overview]
Message-ID: <20150710123211.GB21083@boom> (raw)
In-Reply-To: <1436526655-2965-2-git-send-email-antti.koskipaa@linux.intel.com>

On Fri, Jul 10, 2015 at 02:10:54PM +0300, Antti Koskipaa wrote:
> VBT version 196 increased the size of common_child_dev_config. The parser
> code assumed that the size of this structure would not change.
> 
> So now, instead of checking for smaller size, check that the VBT entry is
> not too large and memcpy only child_dev_size amount of data, leaving any
> trailing entries as zero. If this is not good enough for the future,
> we can always sprinkle extra version checks in there.
> 
> Signed-off-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 2ff9eb0..763a636 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1022,10 +1022,15 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
>  		DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n");
>  		return;
>  	}
> -	if (p_defs->child_dev_size < sizeof(*p_child)) {
> +	/* Historically, child_dev_size has to be at least 33 bytes in size. */
> +	if (p_defs->child_dev_size < 33) {
>  		DRM_ERROR("General definiton block child device size is too small.\n");

"definition"

>  		return;
>  	}
> +	if (p_defs->child_dev_size > sizeof(*p_child)) {
> +		DRM_ERROR("General definiton block child device size is too large.\n");

"definition"

> +		return;
> +	}
>  	/* get the block size of general definitions */
>  	block_size = get_blocksize(p_defs);
>  	/* get the number of child device */
> @@ -1070,7 +1075,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
>  
>  		child_dev_ptr = dev_priv->vbt.child_dev + count;
>  		count++;
> -		memcpy(child_dev_ptr, p_child, sizeof(*p_child));
> +		memcpy(child_dev_ptr, p_child, p_defs->child_dev_size);
>  	}
>  	return;
>  }
> -- 
> 2.3.6
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-07-10 12:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 11:10 [PATCH 0/2] VBT and I_boost fixes Antti Koskipaa
2015-07-10 11:10 ` [PATCH 1/2] drm/i915: Allow parsing of variable size child device entries from VBT Antti Koskipaa
2015-07-10 12:32   ` David Weinehall [this message]
2015-07-13  9:24   ` Daniel Vetter
2015-07-14  7:11     ` David Weinehall
2015-07-14  8:01       ` Daniel Vetter
2015-08-04 13:55   ` [PATCH 1/2 v2] " David Weinehall
2015-08-05  8:59     ` Daniel Vetter
2015-08-05 15:32       ` David Weinehall
2015-08-06 12:18         ` Daniel Vetter
2015-08-06 14:12           ` David Weinehall
2015-08-06 13:59       ` Michel Thierry
2015-08-06 14:08         ` David Weinehall
2015-08-06 15:31           ` Daniel Vetter
2015-08-12 10:29             ` [PATCH 1/2 v2 addendum] " David Weinehall
2015-08-12 12:13               ` Jani Nikula
2015-08-13 10:30                 ` David Weinehall
2015-08-13 11:35                   ` Jani Nikula
2015-08-12 14:19               ` Jani Nikula
2015-08-13 13:14                 ` [PATCH 1/2 v2 addendum v2] " David Weinehall
2015-08-14  8:07                   ` Timo Aaltonen
2015-08-14  8:42                   ` Jani Nikula
2015-08-14  9:40                     ` Jani Nikula
2015-07-10 11:10 ` [PATCH 2/2] drm/i915: Per-DDI I_boost override Antti Koskipaa
2015-08-06 14:11   ` David Weinehall
2015-08-06 15:31     ` Daniel Vetter

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=20150710123211.GB21083@boom \
    --to=david.weinehall@linux.intel.com \
    --cc=antti.koskipaa@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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