[PATCH v3 6/6] drm/i915/gvt: Check if get_next_pt_type() always returns a valid value
Colin Xu
Colin.Xu at intel.com
Thu Apr 25 05:39:24 UTC 2019
Reviewed-by: Colin Xu <colin.xu at intel.com>
Thans for the fix.
On 2019-04-23 20:04, Aleksei Gimbitskii wrote:
> According to gtt_type_table[] function get_next_pt_type() may returns
> GTT_TYPE_INVALID in some cases. To prevent driver to try to create memory
> page with invalid data type, additional check is added.
>
> Signed-off-by: Aleksei Gimbitskii <aleksei.gimbitskii at intel.com>
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> Cc: Colin Xu <colin.xu at intel.com>
> ---
> drivers/gpu/drm/i915/gvt/gtt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index 927753a59a1e..a3fa7c6f1b9b 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -1085,6 +1085,9 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_spt_by_guest_entry(
> } else {
> int type = get_next_pt_type(we->type);
>
> + if (!gtt_type_is_pt(type))
> + goto err;
> +
> spt = ppgtt_alloc_spt_gfn(vgpu, type, ops->get_pfn(we), ips);
> if (IS_ERR(spt)) {
> ret = PTR_ERR(spt);
--
Best Regards,
Colin Xu
More information about the intel-gvt-dev
mailing list