mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] drm: Fix up and error handling after fbdev changes
@ 2024-10-02 15:06 Dave Stevenson
  2024-10-02 15:06 ` [PATCH 1/2] drm/vc4: Run default client setup for all variants Dave Stevenson
  2024-10-02 15:06 ` [PATCH 2/2] drm/fbdev: Ensure that one of the probe functions is defined Dave Stevenson
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Stevenson @ 2024-10-02 15:06 UTC (permalink / raw)
  To: Maxime Ripard, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Javier Martinez Canillas
  Cc: dri-devel, linux-kernel, Dave Stevenson

I was trying dri-misc-next on Pi4 and getting a NULL deref as vc4
started. The cause was having missed adding DRM_FBDEV_DMA_DRIVER_OPS
to the 2711 struct drm_driver, but also showed up that the handling
in drm_fb_helper_single_fb_probe could fail to call any fbdev_probe
function, and hence the NULL deref.

These two patches fix up vc4, but also throw an error if neither
driver->fbdev_probe nor funcs->fb_probe are defined.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
Dave Stevenson (2):
      drm/vc4: Run default client setup for all variants.
      drm/fbdev: Ensure that one of the probe functions is defined

 drivers/gpu/drm/drm_fb_helper.c | 2 ++
 drivers/gpu/drm/vc4/vc4_drv.c   | 1 +
 2 files changed, 3 insertions(+)
---
base-commit: 86fdd6b9b1e98cfd26249505e8ce72f4fc0de37f
change-id: 20241002-vc4_fbdev_fix-f4c8b11928cd

Best regards,
-- 
Dave Stevenson <dave.stevenson@raspberrypi.com>


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

* [PATCH 1/2] drm/vc4: Run default client setup for all variants.
  2024-10-02 15:06 [PATCH 0/2] drm: Fix up and error handling after fbdev changes Dave Stevenson
@ 2024-10-02 15:06 ` Dave Stevenson
  2024-10-09 11:02   ` Maíra Canal
  2024-10-02 15:06 ` [PATCH 2/2] drm/fbdev: Ensure that one of the probe functions is defined Dave Stevenson
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Stevenson @ 2024-10-02 15:06 UTC (permalink / raw)
  To: Maxime Ripard, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Javier Martinez Canillas
  Cc: dri-devel, linux-kernel, Dave Stevenson

Commit 45903624e9fc ("drm/vc4: Run DRM default client setup")
only added DRM_FBDEV_DMA_DRIVER_OPS for the vc4 (Pi0-3) driver
definition, which caused an issue on vc5 (Pi4) as there was no
fbdev_probe function defined.

Fixes: 45903624e9fc ("drm/vc4: Run DRM default client setup")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 13a1ecddbca3..a238f76a6073 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -238,6 +238,7 @@ const struct drm_driver vc5_drm_driver = {
 #endif
 
 	DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(vc5_dumb_create),
+	DRM_FBDEV_DMA_DRIVER_OPS,
 
 	.fops = &vc4_drm_fops,
 

-- 
2.34.1


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

* [PATCH 2/2] drm/fbdev: Ensure that one of the probe functions is defined
  2024-10-02 15:06 [PATCH 0/2] drm: Fix up and error handling after fbdev changes Dave Stevenson
  2024-10-02 15:06 ` [PATCH 1/2] drm/vc4: Run default client setup for all variants Dave Stevenson
@ 2024-10-02 15:06 ` Dave Stevenson
  1 sibling, 0 replies; 6+ messages in thread
From: Dave Stevenson @ 2024-10-02 15:06 UTC (permalink / raw)
  To: Maxime Ripard, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Javier Martinez Canillas
  Cc: dri-devel, linux-kernel, Dave Stevenson

Commit 5d08c44e47b9 ("drm/fbdev: Add memory-agnostic fbdev client")
added the newer probe function, but left a path where no probe
function was called. fb_helper->fb would then be NULL and the strcpy
would throw a NULL pointer exception.

Handle that error case.

Fixes: 5d08c44e47b9 ("drm/fbdev: Add memory-agnostic fbdev client")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index d5e8994345bb..9c8868d7b9d3 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1635,6 +1635,8 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper)
 		ret = dev->driver->fbdev_probe(fb_helper, &sizes);
 	else if (fb_helper->funcs)
 		ret = fb_helper->funcs->fb_probe(fb_helper, &sizes);
+	else
+		ret = -EINVAL;
 	if (ret < 0)
 		return ret;
 

-- 
2.34.1


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

* Re: [PATCH 1/2] drm/vc4: Run default client setup for all variants.
  2024-10-02 15:06 ` [PATCH 1/2] drm/vc4: Run default client setup for all variants Dave Stevenson
@ 2024-10-09 11:02   ` Maíra Canal
  2024-10-09 12:15     ` Dave Stevenson
  0 siblings, 1 reply; 6+ messages in thread
From: Maíra Canal @ 2024-10-09 11:02 UTC (permalink / raw)
  To: Dave Stevenson, Maxime Ripard, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Javier Martinez Canillas
  Cc: dri-devel, linux-kernel

Hi Dave,

On 10/2/24 12:06, Dave Stevenson wrote:
> Commit 45903624e9fc ("drm/vc4: Run DRM default client setup")
> only added DRM_FBDEV_DMA_DRIVER_OPS for the vc4 (Pi0-3) driver
> definition, which caused an issue on vc5 (Pi4) as there was no
> fbdev_probe function defined.
> 
> Fixes: 45903624e9fc ("drm/vc4: Run DRM default client setup")
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

Reviewed-by: Maíra Canal <mcanal@igalia.com>

Best Regards,
- Maíra

> ---
>   drivers/gpu/drm/vc4/vc4_drv.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 13a1ecddbca3..a238f76a6073 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -238,6 +238,7 @@ const struct drm_driver vc5_drm_driver = {
>   #endif
>   
>   	DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(vc5_dumb_create),
> +	DRM_FBDEV_DMA_DRIVER_OPS,
>   
>   	.fops = &vc4_drm_fops,
>   
> 

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

* Re: [PATCH 1/2] drm/vc4: Run default client setup for all variants.
  2024-10-09 11:02   ` Maíra Canal
@ 2024-10-09 12:15     ` Dave Stevenson
  2024-10-21 16:10       ` Dave Stevenson
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Stevenson @ 2024-10-09 12:15 UTC (permalink / raw)
  To: Maíra Canal
  Cc: Maxime Ripard, Raspberry Pi Kernel Maintenance,
	Maarten Lankhorst, Thomas Zimmermann, David Airlie,
	Simona Vetter, Javier Martinez Canillas, dri-devel, linux-kernel

On Wed, 9 Oct 2024 at 12:02, Maíra Canal <mcanal@igalia.com> wrote:
>
> Hi Dave,
>
> On 10/2/24 12:06, Dave Stevenson wrote:
> > Commit 45903624e9fc ("drm/vc4: Run DRM default client setup")
> > only added DRM_FBDEV_DMA_DRIVER_OPS for the vc4 (Pi0-3) driver
> > definition, which caused an issue on vc5 (Pi4) as there was no
> > fbdev_probe function defined.
> >
> > Fixes: 45903624e9fc ("drm/vc4: Run DRM default client setup")
> > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
>
> Reviewed-by: Maíra Canal <mcanal@igalia.com>

Applied to drm-misc-next.

> Best Regards,
> - Maíra
>
> > ---
> >   drivers/gpu/drm/vc4/vc4_drv.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> > index 13a1ecddbca3..a238f76a6073 100644
> > --- a/drivers/gpu/drm/vc4/vc4_drv.c
> > +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> > @@ -238,6 +238,7 @@ const struct drm_driver vc5_drm_driver = {
> >   #endif
> >
> >       DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(vc5_dumb_create),
> > +     DRM_FBDEV_DMA_DRIVER_OPS,
> >
> >       .fops = &vc4_drm_fops,
> >
> >

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

* Re: [PATCH 1/2] drm/vc4: Run default client setup for all variants.
  2024-10-09 12:15     ` Dave Stevenson
@ 2024-10-21 16:10       ` Dave Stevenson
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Stevenson @ 2024-10-21 16:10 UTC (permalink / raw)
  To: Maxime Ripard, Thomas Zimmermann
  Cc: Raspberry Pi Kernel Maintenance, Maarten Lankhorst, David Airlie,
	Simona Vetter, Javier Martinez Canillas, dri-devel, linux-kernel,
	Maíra Canal

Hi Maxime & Thomas.

Sorry, I'm still learning the processes.

This patch and the 3 from
https://patchwork.freedesktop.org/series/139716/ are in drm-misc-next,
but they are fixes needed for 6.12.
Am I right in thinking I need to "dim cherry-pick" them to
drm-misc-fixes so they get merged there?

Thanks

  Dave

On Wed, 9 Oct 2024 at 13:15, Dave Stevenson
<dave.stevenson@raspberrypi.com> wrote:
>
> On Wed, 9 Oct 2024 at 12:02, Maíra Canal <mcanal@igalia.com> wrote:
> >
> > Hi Dave,
> >
> > On 10/2/24 12:06, Dave Stevenson wrote:
> > > Commit 45903624e9fc ("drm/vc4: Run DRM default client setup")
> > > only added DRM_FBDEV_DMA_DRIVER_OPS for the vc4 (Pi0-3) driver
> > > definition, which caused an issue on vc5 (Pi4) as there was no
> > > fbdev_probe function defined.
> > >
> > > Fixes: 45903624e9fc ("drm/vc4: Run DRM default client setup")
> > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> >
> > Reviewed-by: Maíra Canal <mcanal@igalia.com>
>
> Applied to drm-misc-next.
>
> > Best Regards,
> > - Maíra
> >
> > > ---
> > >   drivers/gpu/drm/vc4/vc4_drv.c | 1 +
> > >   1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> > > index 13a1ecddbca3..a238f76a6073 100644
> > > --- a/drivers/gpu/drm/vc4/vc4_drv.c
> > > +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> > > @@ -238,6 +238,7 @@ const struct drm_driver vc5_drm_driver = {
> > >   #endif
> > >
> > >       DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(vc5_dumb_create),
> > > +     DRM_FBDEV_DMA_DRIVER_OPS,
> > >
> > >       .fops = &vc4_drm_fops,
> > >
> > >

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

end of thread, other threads:[~2024-10-21 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-02 15:06 [PATCH 0/2] drm: Fix up and error handling after fbdev changes Dave Stevenson
2024-10-02 15:06 ` [PATCH 1/2] drm/vc4: Run default client setup for all variants Dave Stevenson
2024-10-09 11:02   ` Maíra Canal
2024-10-09 12:15     ` Dave Stevenson
2024-10-21 16:10       ` Dave Stevenson
2024-10-02 15:06 ` [PATCH 2/2] drm/fbdev: Ensure that one of the probe functions is defined Dave Stevenson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome