Skip to contentSkip to conversation

staging/olpc_docn: reorder the lock sequence to avoid potential dead lock

PATCH RESEND In review Gu Zheng 2 participants 4 messages Nov 5, 2013 – Nov 7, 2013 Staging

lore
Share & tools
lore

Gu Zheng

author
#0 lore raw

PATCH RESEND 2/2 staging/olpc_docn: reorder the lock sequence to avoid potential dead lock

The lock sequence of dcon_blank_fb(fb_info->lock ---> console_lock) is against with the one of console_callback(console_lock ---> fb_info->lock), it'll lead to a potential dead lock, so reorder the lock sequence of dcon_blank_fb to avoid the potential dead lock.

---
 drivers/staging/olpc_dcon/olpc_dcon.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/olpc_dcon/olpc_dcon.c +4 -2
index 198595e..9db88d9 100644
@@ -255,17 +255,19 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank)
 {
 	int err;
 
+	console_lock();
 	if (!lock_fb_info(dcon->fbinfo)) {
+		console_unlock();
 		dev_err(&dcon->client->dev, "unable to lock framebuffer\n");
 		return false;
 	}
-	console_lock();
+
 	dcon->ignore_fb_events = true;
 	err = fb_blank(dcon->fbinfo,
 			blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK);
 	dcon->ignore_fb_events = false;
-	console_unlock();
 	unlock_fb_info(dcon->fbinfo);
+	console_unlock();
 
 	if (err) {
 		dev_err(&dcon->client->dev, "couldn't %sblank framebuffer\n",
Signature · 1 line
1.7.7
#1 lore raw
Quoted 6 lines · Gu Zheng

The lock sequence of dcon_blank_fb(fb_info->lock ---> console_lock) is against with the one of console_callback(console_lock ---> fb_info->lock), it'll lead to a potential dead lock, so reorder the lock sequence of dcon_blank_fb to avoid the potential dead lock.

Relax, Greg isn't taking new patches for another three weeks because the merge window is open.

Also what happened to [PATCH 1/2]?

regards,
dan carpenter

author
#2 lore raw

Hi Dan,

Quoted 10 lines · Dan Carpenter
Quoted 6 lines · Gu Zheng

The lock sequence of dcon_blank_fb(fb_info->lock ---> console_lock) is against with the one of console_callback(console_lock ---> fb_info->lock), it'll lead to a potential dead lock, so reorder the lock sequence of dcon_blank_fb to avoid the potential dead lock.

Relax, Greg isn't taking new patches for another three weeks because the merge window is open.

Got it, I just want to gain some comments about this patch.

Quoted 2 lines

Also what happened to [PATCH 1/2]?

It fixes the similar issue of fb subsystem.
https://patchwork.kernel.org/patch/3140121/

Regards,
Gu

Quoted 10 lines

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 9 lines · Gu Zheng

Hi Dan,

Quoted 6 lines · Dan Carpenter
Quoted 5 lines · Gu Zheng

The lock sequence of dcon_blank_fb(fb_info->lock ---> console_lock) is against with the one of console_callback(console_lock ---> fb_info->lock), it'll lead to a potential dead lock, so reorder the lock sequence of dcon_blank_fb to avoid the potential dead lock.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Relax, Greg isn't taking new patches for another three weeks because the merge window is open.

Got it, I just want to gain some comments about this patch.

If no one complains that means it is approved. :)

regards,
dan carpenter