diff mbox series

drm/fb-helper: generic: Call drm_client_add() after setup is done

Message ID 20190401141358.25309-1-noralf@tronnes.org (mailing list archive)
State New, archived
Headers show
Series drm/fb-helper: generic: Call drm_client_add() after setup is done | expand

Commit Message

Noralf Trønnes April 1, 2019, 2:13 p.m. UTC
Hotplug can happen while drm_fbdev_generic_setup() is running so move
drm_client_add() call after setup is done to avoid
drm_fbdev_client_hotplug() running in two threads at the same time.

Fixes: 9060d7f49376 ("drm/fb-helper: Finish the generic fbdev emulation")
Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_fb_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Vetter April 2, 2019, 7:55 a.m. UTC | #1
On Mon, Apr 01, 2019 at 04:13:58PM +0200, Noralf Trønnes wrote:
> Hotplug can happen while drm_fbdev_generic_setup() is running so move
> drm_client_add() call after setup is done to avoid
> drm_fbdev_client_hotplug() running in two threads at the same time.
> 
> Fixes: 9060d7f49376 ("drm/fb-helper: Finish the generic fbdev emulation")
> Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Not sure we even want a cc: stable on this, things could go boom. I guess
we could backport once there's a bug report, up to you.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 03749a24e4dd..601b17310411 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -3317,8 +3317,6 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
>  		return ret;
>  	}
>  
> -	drm_client_add(&fb_helper->client);
> -
>  	if (!preferred_bpp)
>  		preferred_bpp = dev->mode_config.preferred_depth;
>  	if (!preferred_bpp)
> @@ -3329,6 +3327,8 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
>  	if (ret)
>  		DRM_DEV_DEBUG(dev->dev, "client hotplug ret=%d\n", ret);
>  
> +	drm_client_add(&fb_helper->client);
> +
>  	return 0;
>  }
>  EXPORT_SYMBOL(drm_fbdev_generic_setup);
> -- 
> 2.20.1
>
Noralf Trønnes April 3, 2019, 9:21 a.m. UTC | #2
Den 02.04.2019 09.55, skrev Daniel Vetter:
> On Mon, Apr 01, 2019 at 04:13:58PM +0200, Noralf Trønnes wrote:
>> Hotplug can happen while drm_fbdev_generic_setup() is running so move
>> drm_client_add() call after setup is done to avoid
>> drm_fbdev_client_hotplug() running in two threads at the same time.
>>
>> Fixes: 9060d7f49376 ("drm/fb-helper: Finish the generic fbdev emulation")
>> Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> 
> Not sure we even want a cc: stable on this, things could go boom. I guess
> we could backport once there's a bug report, up to you.
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks, applied with cc stable.

Noralf.

> 
>> ---
>>  drivers/gpu/drm/drm_fb_helper.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
>> index 03749a24e4dd..601b17310411 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -3317,8 +3317,6 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
>>  		return ret;
>>  	}
>>  
>> -	drm_client_add(&fb_helper->client);
>> -
>>  	if (!preferred_bpp)
>>  		preferred_bpp = dev->mode_config.preferred_depth;
>>  	if (!preferred_bpp)
>> @@ -3329,6 +3327,8 @@ int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
>>  	if (ret)
>>  		DRM_DEV_DEBUG(dev->dev, "client hotplug ret=%d\n", ret);
>>  
>> +	drm_client_add(&fb_helper->client);
>> +
>>  	return 0;
>>  }
>>  EXPORT_SYMBOL(drm_fbdev_generic_setup);
>> -- 
>> 2.20.1
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 03749a24e4dd..601b17310411 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -3317,8 +3317,6 @@  int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
 		return ret;
 	}
 
-	drm_client_add(&fb_helper->client);
-
 	if (!preferred_bpp)
 		preferred_bpp = dev->mode_config.preferred_depth;
 	if (!preferred_bpp)
@@ -3329,6 +3327,8 @@  int drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
 	if (ret)
 		DRM_DEV_DEBUG(dev->dev, "client hotplug ret=%d\n", ret);
 
+	drm_client_add(&fb_helper->client);
+
 	return 0;
 }
 EXPORT_SYMBOL(drm_fbdev_generic_setup);