linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Cc: airlied@linux.ie, khilman@baylibre.com,
	dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
	linux-amlogic@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] drm/meson: Fix invalid pointer in meson_drv_unbind()
Date: Mon, 25 Mar 2019 11:19:09 +0100	[thread overview]
Message-ID: <69d7fc67-c892-4c3d-6c39-c79dc51bc3c2@baylibre.com> (raw)
In-Reply-To: <20190322152657.13752-1-jean-philippe.brucker@arm.com>

On 22/03/2019 16:26, Jean-Philippe Brucker wrote:
> meson_drv_bind() registers a meson_drm struct as the device's privdata,
> but meson_drv_unbind() tries to retrieve a drm_device. This may cause a
> segfault on shutdown:
> 
> [ 5194.593429] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000197
>  ...
> [ 5194.788850] Call trace:
> [ 5194.791349]  drm_dev_unregister+0x1c/0x118 [drm]
> [ 5194.795848]  meson_drv_unbind+0x50/0x78 [meson_drm]
> 
> Retrieve the right pointer in meson_drv_unbind().
> 
> Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
> Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
> ---
>  drivers/gpu/drm/meson/meson_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 2281ed3eb774..7e85802c5398 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -356,8 +356,8 @@ static int meson_drv_bind(struct device *dev)
>  
>  static void meson_drv_unbind(struct device *dev)
>  {
> -	struct drm_device *drm = dev_get_drvdata(dev);
> -	struct meson_drm *priv = drm->dev_private;
> +	struct meson_drm *priv = dev_get_drvdata(dev);
> +	struct drm_device *drm = priv->drm;
>  
>  	if (priv->canvas) {
>  		meson_canvas_free(priv->canvas, priv->canvas_id_osd1);
> 

Applied both to drm-misc-fixes, thanks !

Neil

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

      parent reply	other threads:[~2019-03-25 10:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-22 15:26 [PATCH 1/2] drm/meson: Fix invalid pointer in meson_drv_unbind() Jean-Philippe Brucker
2019-03-22 15:26 ` [PATCH 2/2] drm/meson: Uninstall IRQ handler Jean-Philippe Brucker
2019-03-23  9:54   ` Neil Armstrong
2019-03-23  9:53 ` [PATCH 1/2] drm/meson: Fix invalid pointer in meson_drv_unbind() Neil Armstrong
2019-03-25 10:19 ` Neil Armstrong [this message]

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=69d7fc67-c892-4c3d-6c39-c79dc51bc3c2@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jean-philippe.brucker@arm.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).