Commit fc0524b0 authored by Gu Zheng's avatar Gu Zheng Committed by Greg Kroah-Hartman

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.
Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9961d59d
...@@ -255,17 +255,19 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank) ...@@ -255,17 +255,19 @@ static bool dcon_blank_fb(struct dcon_priv *dcon, bool blank)
{ {
int err; int err;
console_lock();
if (!lock_fb_info(dcon->fbinfo)) { if (!lock_fb_info(dcon->fbinfo)) {
console_unlock();
dev_err(&dcon->client->dev, "unable to lock framebuffer\n"); dev_err(&dcon->client->dev, "unable to lock framebuffer\n");
return false; return false;
} }
console_lock();
dcon->ignore_fb_events = true; dcon->ignore_fb_events = true;
err = fb_blank(dcon->fbinfo, err = fb_blank(dcon->fbinfo,
blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK); blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK);
dcon->ignore_fb_events = false; dcon->ignore_fb_events = false;
console_unlock();
unlock_fb_info(dcon->fbinfo); unlock_fb_info(dcon->fbinfo);
console_unlock();
if (err) { if (err) {
dev_err(&dcon->client->dev, "couldn't %sblank framebuffer\n", dev_err(&dcon->client->dev, "couldn't %sblank framebuffer\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment