All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH 2/2] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock
@ 2013-11-05 10:01 Gu Zheng
  2013-11-05 11:02 ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Gu Zheng @ 2013-11-05 10:01 UTC (permalink / raw)
  To: jfrederich, dsd, jon.nettleton, Greg Kroah-Hartman
  Cc: devel, Tomi Valkeinen, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel

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.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 drivers/staging/olpc_dcon/olpc_dcon.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
index 198595e..9db88d9 100644
--- a/drivers/staging/olpc_dcon/olpc_dcon.c
+++ b/drivers/staging/olpc_dcon/olpc_dcon.c
@@ -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",
-- 
1.7.7


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

* Re: [RESEND PATCH 2/2] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock
  2013-11-05 10:01 [RESEND PATCH 2/2] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock Gu Zheng
@ 2013-11-05 11:02 ` Dan Carpenter
  2013-11-06  1:22   ` Gu Zheng
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2013-11-05 11:02 UTC (permalink / raw)
  To: Gu Zheng
  Cc: jfrederich, dsd, jon.nettleton, Greg Kroah-Hartman, devel,
	Tomi Valkeinen, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel

On Tue, Nov 05, 2013 at 06:01:00PM +0800, Gu Zheng wrote:
> 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.
> 
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>

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


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

* Re: [RESEND PATCH 2/2] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock
  2013-11-05 11:02 ` Dan Carpenter
@ 2013-11-06  1:22   ` Gu Zheng
  2013-11-07 11:38     ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Gu Zheng @ 2013-11-06  1:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: jfrederich, dsd, jon.nettleton, Greg Kroah-Hartman, devel,
	Tomi Valkeinen, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel

Hi Dan,
On 11/05/2013 07:02 PM, Dan Carpenter wrote:

> On Tue, Nov 05, 2013 at 06:01:00PM +0800, Gu Zheng wrote:
>> 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.
>>
>> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> 
> 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.

> 
> Also what happened to [PATCH 1/2]?

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

Regards,
Gu

> 
> regards,
> dan carpenter
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 



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

* Re: [RESEND PATCH 2/2] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock
  2013-11-06  1:22   ` Gu Zheng
@ 2013-11-07 11:38     ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-11-07 11:38 UTC (permalink / raw)
  To: Gu Zheng
  Cc: jfrederich, dsd, jon.nettleton, Greg Kroah-Hartman, devel,
	Tomi Valkeinen, Jean-Christophe PLAGNIOL-VILLARD, linux-kernel

On Wed, Nov 06, 2013 at 09:22:36AM +0800, Gu Zheng wrote:
> Hi Dan,
> On 11/05/2013 07:02 PM, Dan Carpenter wrote:
> 
> > On Tue, Nov 05, 2013 at 06:01:00PM +0800, Gu Zheng wrote:
> >> 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.
> >>
> >> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> > 
> > 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


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

end of thread, other threads:[~2013-11-07 11:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05 10:01 [RESEND PATCH 2/2] staging/olpc_docn: reorder the lock sequence to avoid potential dead lock Gu Zheng
2013-11-05 11:02 ` Dan Carpenter
2013-11-06  1:22   ` Gu Zheng
2013-11-07 11:38     ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.