fbcon: fix workqueue shutdown

Add a call to cancel_work_sync() in fbcon_exit() to cancel any pending
work in the fbcon workqueue.

The current implementation of fbcon_exit() sets the fbcon workqueue
function info->queue.func to NULL, but does not assure that there is no
work pending when it does so. On occasion, depending on system timing,
there will still be pending work in the queue when fbcon_exit() is
called. This results in a null pointer deference when run_workqueue()
tries to call the queue's work function.

Fixes errors on shutdown similar to these:

Console: switching to colour dummy device 80x25
Unable to handle kernel paging request for data at address 0x00000000

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Geoff Levand and committed by
Linus Torvalds
beaa4867 6841c8e2

+6
+6
drivers/video/console/fbcon.c
··· 3531 3531 softback_buf = 0UL; 3532 3532 3533 3533 for (i = 0; i < FB_MAX; i++) { 3534 + int pending; 3535 + 3534 3536 mapped = 0; 3535 3537 info = registered_fb[i]; 3536 3538 3537 3539 if (info == NULL) 3538 3540 continue; 3541 + 3542 + pending = cancel_work_sync(&info->queue); 3543 + DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" : 3544 + "no")); 3539 3545 3540 3546 for (j = first_fb_vc; j <= last_fb_vc; j++) { 3541 3547 if (con2fb_map[j] == i)