lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 22 Feb 2017 16:56:23 -0800
From:   John Stultz <>
To:     lkml <>
Cc:     John Stultz <>,
        Xinliang Liu <>,
        Rongrong Zou <>,
        Xinwei Kong <>,
        Chen Feng <>,
        David Airlie <>,
        Daniel Vetter <>,
        Sean Paul <>,
Subject: [RFC][PATCH] drm: kirin: Add a mutex to avoid fb initialization race

In some cases I've been seeing a race where two framebuffers
would be initialized, as kirin_fbdev_output_poll_changed()
might get called quickly in succession, resulting in the fb
initialization happening twice. This could cause the system
to boot up with a blank screen.

This patch adds a simple mutex to serialize it and seems to
avoid the race.

Obviously I suspect this patch isn't the best solution, but
I wanted to send it out as something concrete to discuss the

Suggestions or feedback for a better solution would be greatly

Cc: Xinliang Liu <>
Cc: Rongrong Zou <>
Cc: Xinwei Kong <>
Cc: Chen Feng <>
Cc: David Airlie <>
Cc: Daniel Vetter <>
Cc: Sean Paul <>
Signed-off-by: John Stultz <>
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index ebd5f4f..80c607f 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -50,11 +50,13 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)
 	return 0;
+static DEFINE_MUTEX(fb_lock);
 static void kirin_fbdev_output_poll_changed(struct drm_device *dev)
 	struct kirin_drm_private *priv = dev->dev_private;
+	mutex_lock(&fb_lock);
 	if (priv->fbdev) {
 	} else {
@@ -64,6 +66,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device *dev)
 		if (IS_ERR(priv->fbdev))
 			priv->fbdev = NULL;
+	mutex_unlock(&fb_lock);

Powered by blists - more mailing lists