Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gu Zheng and committed by
Greg Kroah-Hartman
fc0524b0 9961d59d

+4 -2
+4 -2
drivers/staging/olpc_dcon/olpc_dcon.c
··· 255 255 { 256 256 int err; 257 257 258 + console_lock(); 258 259 if (!lock_fb_info(dcon->fbinfo)) { 260 + console_unlock(); 259 261 dev_err(&dcon->client->dev, "unable to lock framebuffer\n"); 260 262 return false; 261 263 } 262 - console_lock(); 264 + 263 265 dcon->ignore_fb_events = true; 264 266 err = fb_blank(dcon->fbinfo, 265 267 blank ? FB_BLANK_POWERDOWN : FB_BLANK_UNBLANK); 266 268 dcon->ignore_fb_events = false; 267 - console_unlock(); 268 269 unlock_fb_info(dcon->fbinfo); 270 + console_unlock(); 269 271 270 272 if (err) { 271 273 dev_err(&dcon->client->dev, "couldn't %sblank framebuffer\n",