linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/msm: correct NULL pointer dereference in context_init
@ 2019-06-27  2:05 Brian Masney
  2019-06-28 12:57 ` [Freedreno] " Rob Clark
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Masney @ 2019-06-27  2:05 UTC (permalink / raw)
  To: jcrouse, robdclark, seanpaul
  Cc: freedreno, jean-philippe.brucker, linux-arm-msm, hoegsberg,
	dianders, linux-kernel, dri-devel, airlied, daniel

Correct attempted NULL pointer dereference in context_init() when
running without an IOMMU.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Fixes: 295b22ae596c ("drm/msm: Pass the MMU domain index in struct msm_file_private")
---
The no IOMMU case seems like functionality that we may want to keep
based on this comment:
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/msm/adreno/a3xx_gpu.c#L523
Once I get the msm8974 interconnect driver done, I'm going to look into
what needs to be done to get the IOMMU working on the Nexus 5.

Alternatively, for development purposes, maybe we could have a NOOP
IOMMU driver that would allow us to remove these NULL checks that are
sprinkled throughout the code. I haven't looked into this in detail.
Thoughts?

 drivers/gpu/drm/msm/msm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 451bd4508793..83047cb2c735 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -619,7 +619,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file)
 
 	msm_submitqueue_init(dev, ctx);
 
-	ctx->aspace = priv->gpu->aspace;
+	ctx->aspace = priv->gpu ? priv->gpu->aspace : NULL;
 	file->driver_priv = ctx;
 
 	return 0;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Freedreno] [PATCH] drm/msm: correct NULL pointer dereference in context_init
  2019-06-27  2:05 [PATCH] drm/msm: correct NULL pointer dereference in context_init Brian Masney
@ 2019-06-28 12:57 ` Rob Clark
  2019-07-22 18:22   ` Sean Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Clark @ 2019-06-28 12:57 UTC (permalink / raw)
  To: Brian Masney
  Cc: Jordan Crouse, Rob Clark, Sean Paul, Jean-Philippe Brucker,
	linux-arm-msm, Douglas Anderson, dri-devel,
	Linux Kernel Mailing List, David Airlie, Kristian H. Kristensen,
	Daniel Vetter, freedreno

On Wed, Jun 26, 2019 at 7:05 PM Brian Masney <masneyb@onstation.org> wrote:
>
> Correct attempted NULL pointer dereference in context_init() when
> running without an IOMMU.
>
> Signed-off-by: Brian Masney <masneyb@onstation.org>
> Fixes: 295b22ae596c ("drm/msm: Pass the MMU domain index in struct msm_file_private")
> ---
> The no IOMMU case seems like functionality that we may want to keep
> based on this comment:
> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/msm/adreno/a3xx_gpu.c#L523
> Once I get the msm8974 interconnect driver done, I'm going to look into
> what needs to be done to get the IOMMU working on the Nexus 5.
>
> Alternatively, for development purposes, maybe we could have a NOOP
> IOMMU driver that would allow us to remove these NULL checks that are
> sprinkled throughout the code. I haven't looked into this in detail.
> Thoughts?

yeah, we probably want to keep !iommu support, it is at least useful
for bringup of new (or old) devices.  But tends to bitrot a since it
isn't a case that gets tested much once iommu is in place.  Perhaps
there is a way to have a null iommu/aspace, although I'm not quite
sure how that would work..

Anyways,

Reviewed-by: Rob Clark <robdclark@gmail.com>

(I guess this can go in via drm-misc-fixes unless we get some more
fixes to justify sending msm-fixes MR..)

>
>  drivers/gpu/drm/msm/msm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 451bd4508793..83047cb2c735 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -619,7 +619,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file)
>
>         msm_submitqueue_init(dev, ctx);
>
> -       ctx->aspace = priv->gpu->aspace;
> +       ctx->aspace = priv->gpu ? priv->gpu->aspace : NULL;
>         file->driver_priv = ctx;
>
>         return 0;
> --
> 2.20.1
>
> _______________________________________________
> Freedreno mailing list
> Freedreno@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Freedreno] [PATCH] drm/msm: correct NULL pointer dereference in context_init
  2019-06-28 12:57 ` [Freedreno] " Rob Clark
@ 2019-07-22 18:22   ` Sean Paul
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Paul @ 2019-07-22 18:22 UTC (permalink / raw)
  To: Rob Clark
  Cc: Brian Masney, Jordan Crouse, Rob Clark, Sean Paul,
	Jean-Philippe Brucker, linux-arm-msm, Douglas Anderson,
	dri-devel, Linux Kernel Mailing List, David Airlie,
	Kristian H. Kristensen, Daniel Vetter, freedreno

On Fri, Jun 28, 2019 at 05:57:26AM -0700, Rob Clark wrote:
> On Wed, Jun 26, 2019 at 7:05 PM Brian Masney <masneyb@onstation.org> wrote:
> >
> > Correct attempted NULL pointer dereference in context_init() when
> > running without an IOMMU.
> >
> > Signed-off-by: Brian Masney <masneyb@onstation.org>
> > Fixes: 295b22ae596c ("drm/msm: Pass the MMU domain index in struct msm_file_private")
> > ---
> > The no IOMMU case seems like functionality that we may want to keep
> > based on this comment:
> > https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/msm/adreno/a3xx_gpu.c#L523
> > Once I get the msm8974 interconnect driver done, I'm going to look into
> > what needs to be done to get the IOMMU working on the Nexus 5.
> >
> > Alternatively, for development purposes, maybe we could have a NOOP
> > IOMMU driver that would allow us to remove these NULL checks that are
> > sprinkled throughout the code. I haven't looked into this in detail.
> > Thoughts?
> 
> yeah, we probably want to keep !iommu support, it is at least useful
> for bringup of new (or old) devices.  But tends to bitrot a since it
> isn't a case that gets tested much once iommu is in place.  Perhaps
> there is a way to have a null iommu/aspace, although I'm not quite
> sure how that would work..
> 
> Anyways,
> 
> Reviewed-by: Rob Clark <robdclark@gmail.com>
> 
> (I guess this can go in via drm-misc-fixes unless we get some more
> fixes to justify sending msm-fixes MR..)

Applied to drm-misc-fixes for 5.3

Sean

> 
> >
> >  drivers/gpu/drm/msm/msm_drv.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> > index 451bd4508793..83047cb2c735 100644
> > --- a/drivers/gpu/drm/msm/msm_drv.c
> > +++ b/drivers/gpu/drm/msm/msm_drv.c
> > @@ -619,7 +619,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file)
> >
> >         msm_submitqueue_init(dev, ctx);
> >
> > -       ctx->aspace = priv->gpu->aspace;
> > +       ctx->aspace = priv->gpu ? priv->gpu->aspace : NULL;
> >         file->driver_priv = ctx;
> >
> >         return 0;
> > --
> > 2.20.1
> >
> > _______________________________________________
> > Freedreno mailing list
> > Freedreno@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/freedreno

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-22 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27  2:05 [PATCH] drm/msm: correct NULL pointer dereference in context_init Brian Masney
2019-06-28 12:57 ` [Freedreno] " Rob Clark
2019-07-22 18:22   ` Sean Paul

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).