linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
	linux-fbdev-devel@lists.sourceforge.netGeert, adaplas@gmail.com
Subject: Re: [patch] fbcon: Fix workqueue shutdown
Date: Sat, 6 Dec 2008 23:16:42 -0800	[thread overview]
Message-ID: <20081206231642.e685d7f0.akpm@linux-foundation.org> (raw)
In-Reply-To: <493722F0.5070707@am.sony.com>

On Wed, 3 Dec 2008 16:23:12 -0800 Geoff Levand <geoffrey.levand@am.sony.com> wrote:

> Add a call to cancel_work_sync() in fbcon_exit() to cancel
> any pending work in the fbcon workqueue.  Also, change the
> assignment of the workqueue function info->queue.func from
> NULL to fb_flashcursor(),

OK.

> and add a corresponding check in
> fb_flashcursor() to exit immediately if the variable
> fbcon_has_exited is set.

Why was this second part added?

> 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
> 
> ...
>
> --- a/drivers/video/console/fbcon.c
> +++ b/drivers/video/console/fbcon.c
> @@ -394,13 +394,19 @@ static void fbcon_update_softback(struct
>  
>  static void fb_flashcursor(struct work_struct *work)
>  {
> -	struct fb_info *info = container_of(work, struct fb_info, queue);
> -	struct fbcon_ops *ops = info->fbcon_par;
> +	struct fb_info *info;
> +	struct fbcon_ops *ops;
>  	struct display *p;
>  	struct vc_data *vc = NULL;
>  	int c;
>  	int mode;
>  
> +	if (fbcon_has_exited)
> +		return;

This whole fbcon_has_exited thing has big red "wrong" lights flashing
all over it.

If drivers get all their refcounting, locking and synchronisation
correct, such things are unneeded.


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

  reply	other threads:[~2008-12-07  7:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 17:13 [patch] fbcon: Fix workqueue shutdown Geoff Levand
2008-12-04  0:23 ` Geoff Levand
2008-12-07  7:16   ` Andrew Morton [this message]
2008-12-08 20:54     ` Geoff Levand
2008-12-08 20:58   ` [patch v2] " Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081206231642.e685d7f0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=adaplas@gmail.com \
    --cc=geoffrey.levand@am.sony.com \
    --cc=linux-fbdev-devel@lists.sourceforge.netGeert \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).