Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6662239yba; Tue, 14 May 2019 11:15:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzuUtIKeW5KDuqf/V/bULaFak9FVB1z8pUgIHokS39LurHNwHOdLT+EqYgpWGYw+YfaUfs X-Received: by 2002:aa7:9242:: with SMTP id 2mr42967397pfp.230.1557857710796; Tue, 14 May 2019 11:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557857710; cv=none; d=google.com; s=arc-20160816; b=MhNe2FETJ7Tvk1dzcvNWV5v/Xt2mu/ltSLeMPobAygjCvKlA49pqwk6i51dReZtB/W wtm6+AL6edjXKydi9fXN16ytbl3TAlUaWYtQmbTZESwaWRWDJK6UnpcGvceh9Pv885dO +eNaVraNvtZ1J6dMwINpGn0CfZCP4nDJpU+5N7PdU1M3gRzD/oU/PxYHgXwstOlnYPFl YpohzDRmDIG5puC29QJ/rq5ULQHP6IWv2oifmCOYXmaXPplPRAvq4KqgsiDst1Oy7uQ8 3EABAigMu8E01W00WZLJgvIRsRRXKKbFkCoj5cxlFbE4WpyRHiUoGZYayLOmzNVfzSWw Diww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=sZPPr8NGhHoJdmUxN5wiV/8svlug9VYTHhuXEbiDTIs=; b=Ph/zYKPyTSR9XljGU7tof9PQMlpxr4N5/olrHDNlAuZ5/VUUNGFc6frcMYwiRhEKVp h7E3F1r5CVbXxX2YMjQcH7KsoOBK714vmtA+pXsHlYtOCa9Tym3RcCmfH7e3ZL5a3jRf efqXrhzaLAPKu1IWP2ZwTCe4hKPQs+yYg5o1vSNqQqa59rBr07MjOMgRxjahsV0RECTs mID0CiTQiM/fwgM0peg+JyuljDVgaOLYqhXIWJh5DVFLYjUfJIIJWfFgQu6UBaOOefh2 Ofx197tNwUFOYx4hOK52mcf3tq1e/beIWwelzmClXXBDndjRrJWWoYMkKUP5yjr4rwYa FgjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=J0sdHWzH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si5556123pfw.148.2019.05.14.11.14.56; Tue, 14 May 2019 11:15:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=J0sdHWzH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727531AbfENSMc (ORCPT + 99 others); Tue, 14 May 2019 14:12:32 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:33812 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbfENSMc (ORCPT ); Tue, 14 May 2019 14:12:32 -0400 Received: by mail-qk1-f194.google.com with SMTP id j20so123824qke.1 for ; Tue, 14 May 2019 11:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sZPPr8NGhHoJdmUxN5wiV/8svlug9VYTHhuXEbiDTIs=; b=J0sdHWzHgNXc/T6S5pXJau+wiI3sT1CAKCHzpcU9ZfRdac6fquW/qSi/EdFnTd8/hv I8v4S+RoINJT2chsyyNhKb/+oR1z+ZiqLKlVP4POFtN19qaB9e2bIYBKrht/mnOqIssB PBzGjFwsMbr892LK0Kt8UtTMx2c6hCWUBfvsKwvqFMlr/4KfhetV2wbzHv/7Dcnps+Ia PZDiauM/MENz/lQ9d9OKQKlUUl1QBhScvjb8RQ/vUTp3GDzptRDdcpTLScpOPqCxes8Y HRkD2PJv0Uf8MNG5uqNIDUGm71WPo0g09yWu+RKoQI4Uci7SPfOGMVH0Zfh3pgdAIlOm gedQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sZPPr8NGhHoJdmUxN5wiV/8svlug9VYTHhuXEbiDTIs=; b=DufaFqFo5kbb0NLl/2q2TaEk7aqMCFZzSOT1Tat5UD2h6Jv5kUoyoOt5Vz4IFy7JAq Q6MHMZs64zLAHeVxBw8pYA5iROFFglB5VkYV1rvWMvQqbZSLGZwvY8praGS8DbTMT9l3 ZxNOLTTSzVBiTafPLNr0elijXpm0y6M4ix72co/UgMP16pkFL+FpDvlm07xC2HtJSr4V IXlzbdX+gezy8ChjzD77RnW4r+g/Rz3bEme0gbJZydVCUzzd50Bd3rmo+tHkVjUfLVOc vAmRZE2Pq1KOsxWbMu1vnTekQfLXwTvMk1NZzU94mlv0B1KsirG5+lQH7n2Ed59juYRH hANA== X-Gm-Message-State: APjAAAVs+ocFeL0e4WIigtNDnb4bw7rlcCJuxNZ+tHKIw71t4uMfWxcB furlhkqK4p8lufN3EizhbwSLXjix1uc= X-Received: by 2002:a37:5005:: with SMTP id e5mr28417713qkb.99.1557857550434; Tue, 14 May 2019 11:12:30 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id e8sm8209768qtm.34.2019.05.14.11.12.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 11:12:29 -0700 (PDT) Date: Tue, 14 May 2019 14:12:29 -0400 From: Sean Paul To: Brian Masney Cc: robdclark@gmail.com, sean@poorly.run, bjorn.andersson@linaro.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, airlied@linux.ie, daniel@ffwll.ch, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, jonathan@marek.ca, robh@kernel.org Subject: Re: [PATCH v2.1 1/2] drm/msm: remove resv fields from msm_gem_object struct Message-ID: <20190514181229.GR17077@art_vandelay> References: <20190513234105.7531-1-masneyb@onstation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190513234105.7531-1-masneyb@onstation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 13, 2019 at 07:41:04PM -0400, Brian Masney wrote: > The msm_gem_object structure contains resv and _resv fields that are > no longer needed since the reservation object is now stored on > drm_gem_object. msm_atomic_prepare_fb() and msm_atomic_prepare_fb() > both referenced the wrong reservation object, and would lead to an > attempt to dereference a NULL pointer. Correct those two cases to > point to the correct reservation object. > > Signed-off-by: Brian Masney Thanks Brian for your patches. I've applied them to drm-misc-next-fixes for inclusion in 5.2 Sean > Reviewed-by: Bjorn Andersson > Tested-by: Bjorn Andersson > Fixes: dd55cf6929e6 ("drm: msm: Switch to use drm_gem_object reservation_object") > --- > This is a split out version of this patch from where I am working to get > the display working on the Nexus 5: > > https://lore.kernel.org/lkml/20190509020352.14282-2-masneyb@onstation.org/ > > Bjorn asks: > This resolves a NULL-pointer dereference about to show up in v5.2-rc1, > so please pick this up for -rc. > > In this version, I dropped the change to msm_gem_new_impl() that > mistakenly removed 'msm_obj->base.resv = resv;'. I did not put a v3 on > this patch since I wanted to keep that version number for the larger work > to get the display working on the Nexus 5 so I went with 2.1 here. :) > > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 4 +--- > drivers/gpu/drm/msm/msm_atomic.c | 4 +--- > drivers/gpu/drm/msm/msm_gem.h | 4 ---- > 3 files changed, 2 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > index 4fca24b8702c..f3d009a3dc63 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > @@ -781,7 +781,6 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, > struct dpu_plane_state *pstate = to_dpu_plane_state(new_state); > struct dpu_hw_fmt_layout layout; > struct drm_gem_object *obj; > - struct msm_gem_object *msm_obj; > struct dma_fence *fence; > struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); > int ret; > @@ -800,8 +799,7 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, > * implicit fence and fb prepare by hand here. > */ > obj = msm_framebuffer_bo(new_state->fb, 0); > - msm_obj = to_msm_bo(obj); > - fence = reservation_object_get_excl_rcu(msm_obj->resv); > + fence = reservation_object_get_excl_rcu(obj->resv); > if (fence) > drm_atomic_set_fence_for_plane(new_state, fence); > > diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c > index f5b1256e32b6..131c23a267ee 100644 > --- a/drivers/gpu/drm/msm/msm_atomic.c > +++ b/drivers/gpu/drm/msm/msm_atomic.c > @@ -49,15 +49,13 @@ int msm_atomic_prepare_fb(struct drm_plane *plane, > struct msm_drm_private *priv = plane->dev->dev_private; > struct msm_kms *kms = priv->kms; > struct drm_gem_object *obj; > - struct msm_gem_object *msm_obj; > struct dma_fence *fence; > > if (!new_state->fb) > return 0; > > obj = msm_framebuffer_bo(new_state->fb, 0); > - msm_obj = to_msm_bo(obj); > - fence = reservation_object_get_excl_rcu(msm_obj->resv); > + fence = reservation_object_get_excl_rcu(obj->resv); > > drm_atomic_set_fence_for_plane(new_state, fence); > > diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h > index c5ac781dffee..812d1b1369a5 100644 > --- a/drivers/gpu/drm/msm/msm_gem.h > +++ b/drivers/gpu/drm/msm/msm_gem.h > @@ -86,10 +86,6 @@ struct msm_gem_object { > > struct llist_node freed; > > - /* normally (resv == &_resv) except for imported bo's */ > - struct reservation_object *resv; > - struct reservation_object _resv; > - > /* For physically contiguous buffers. Used when we don't have > * an IOMMU. Also used for stolen/splashscreen buffer. > */ > -- > 2.20.1 > -- Sean Paul, Software Engineer, Google / Chromium OS