public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
	Douglas Anderson <dianders@chromium.org>,
	Rob Clark <robdclark@gmail.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <robert.foss@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Sean Paul <sean@poorly.run>, Stephen Boyd <swboyd@chromium.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/7] drm/msm: fix use-after-free on probe deferral
Date: Tue, 13 Sep 2022 09:31:13 +0200	[thread overview]
Message-ID: <YyAxwQmN9SDrWa7n@hovoldconsulting.com> (raw)
In-Reply-To: <518564a8-5206-80cc-8306-50296de43abf@linaro.org>

On Mon, Sep 12, 2022 at 08:52:44PM +0300, Dmitry Baryshkov wrote:
> On 12/09/2022 18:40, Johan Hovold wrote:
> > The bridge counter was never reset when tearing down the DRM device so
> > that stale pointers to deallocated structures would be accessed on the
> > next tear down (e.g. after a second late bind deferral).
> > 
> > Given enough bridges and a few probe deferrals this could currently also
> > lead to data beyond the bridge array being corrupted.
> > 
> > Fixes: d28ea556267c ("drm/msm: properly add and remove internal bridges")
> > Cc: stable@vger.kernel.org      # 5.19
> 
> Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge")
> Cc: stable@vger.kernel.org # 3.12

The use after free was introduced in 5.19, and the next patch takes care
of the possible overflow of the bridges array that has been around since
3.12.

But sure, this oversight has been there since 3.12. I'll reconsider
adding the other Fixes tag. The stable team struggles with context
changes apparently so not sure it's worth backporting, though.

> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> > ---
> >   drivers/gpu/drm/msm/msm_drv.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> > index 391d86b54ded..d254fe2507ec 100644
> > --- a/drivers/gpu/drm/msm/msm_drv.c
> > +++ b/drivers/gpu/drm/msm/msm_drv.c
> > @@ -241,6 +241,7 @@ static int msm_drm_uninit(struct device *dev)
> >   
> >   	for (i = 0; i < priv->num_bridges; i++)
> >   		drm_bridge_remove(priv->bridges[i]);
> > +	priv->num_bridges = 0;
> >   
> >   	pm_runtime_get_sync(dev);
> >   	msm_irq_uninstall(ddev);

Johan

  reply	other threads:[~2022-09-13  7:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 15:40 [PATCH 0/7] drm/msm: probe deferral fixes Johan Hovold
2022-09-12 15:40 ` [PATCH 1/7] drm/msm: fix use-after-free on probe deferral Johan Hovold
2022-09-12 17:52   ` Dmitry Baryshkov
2022-09-13  7:31     ` Johan Hovold [this message]
2022-09-12 15:40 ` [PATCH 2/7] drm/msm: fix memory corruption with too many bridges Johan Hovold
2022-09-12 17:55   ` Dmitry Baryshkov
2022-09-13  7:49     ` Johan Hovold
2022-09-12 15:40 ` [PATCH 3/7] drm/msm/dp: fix IRQ lifetime Johan Hovold
2022-09-12 18:06   ` Dmitry Baryshkov
2022-09-12 15:40 ` [PATCH 4/7] drm/msm/dp: fix aux-bus EP lifetime Johan Hovold
2022-09-12 18:10   ` Dmitry Baryshkov
2022-09-12 21:55     ` Steev Klimaszewski
2022-09-13  7:20       ` Johan Hovold
2022-09-13  6:35     ` Doug Anderson
2022-09-13  7:18       ` Johan Hovold
2022-09-13  1:51   ` kernel test robot
2022-09-12 15:40 ` [PATCH 5/7] drm/msm/dp: fix bridge lifetime Johan Hovold
2022-09-12 18:11   ` Dmitry Baryshkov
2022-09-12 15:40 ` [PATCH 6/7] drm/msm/hdmi: fix IRQ lifetime Johan Hovold
2022-09-12 17:59   ` Dmitry Baryshkov
2022-09-12 15:40 ` [PATCH 7/7] drm/msm: drop modeset sanity checks Johan Hovold
2022-09-12 18:06   ` Dmitry Baryshkov
2022-09-13  7:53     ` Johan Hovold
2022-09-12 17:11 ` [PATCH 0/7] drm/msm: probe deferral fixes Abhinav Kumar

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=YyAxwQmN9SDrWa7n@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=andersson@kernel.org \
    --cc=andrzej.hajda@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=johan+linaro@kernel.org \
    --cc=jonas@kwiboo.se \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robdclark@gmail.com \
    --cc=robert.foss@linaro.org \
    --cc=sean@poorly.run \
    --cc=stable@vger.kernel.org \
    --cc=swboyd@chromium.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