mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Andrea Righi <righi.andrea@gmail.com>
Cc: Andrey Borzenkov <arvidjaar@mail.ru>,
	Linux Frame Buffer Device Development 
	<linux-fbdev-devel@lists.sourceforge.net>,
	"Antonino A. Daplas" <adaplas@gmail.com>,
	linux-pm@lists.linux-foundation.org,
	Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: [Linux-fbdev-devel] [2.6.29-rc2] fb_mmap: circular locking dependency on hibernation
Date: Sat, 31 Jan 2009 18:44:45 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0901311843450.21273@anakin> (raw)
In-Reply-To: <498485E0.4080501@gmail.com>

On Sat, 31 Jan 2009, Andrea Righi wrote:
> On 2009-01-30 05:15, Andrey Borzenkov wrote:
> > On 29 of January 2009 12:10:11 Geert Uytterhoeven wrote:
> >> On Tue, 27 Jan 2009, Andrey Borzenkov wrote:
> fbcon: avoid circular locking dependency between fb_info->lock and mm->mmap_sem
> 
> In fbcon notifier the handler for FB_EVENT_SET_CONSOLE_MAP doesn't need
> to hold fb_info->lock.
> 
> Simply unlock it before calling set_con2fb_map(), that could try to
> acquire mm->mmap_sem to avoid a circular locking dependency with
> fb_mmap() (that acquires mm->mmap_sem -> fb_info-lock).

However, set_con2fb_map() accesses the array of fb_info pointers
registered_fb[], which seems to be a bit unsafe now the BKL is no longer held.

> Reported-by: Andrey Borzenkov <arvidjaar@mail.ru>
> Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
> ---
>  drivers/video/console/fbcon.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
> index 1657b96..81fc2f7 100644
> --- a/drivers/video/console/fbcon.c
> +++ b/drivers/video/console/fbcon.c
> @@ -3169,9 +3169,15 @@ static int fbcon_event_notify(struct notifier_block *self,
>  		ret = fbcon_fb_unregistered(info);
>  		break;
>  	case FB_EVENT_SET_CONSOLE_MAP:
> +		/*
> +		 * XXX: info is not used here, we can unlock it to avoid
> +		 * circular locking with &current->mm->mmap_sem in fb_mmap().
> +		 */
> +		unlock_fb_info(info);
>  		con2fb = event->data;
>  		ret = set_con2fb_map(con2fb->console - 1,
>  				     con2fb->framebuffer, 1);
> +		lock_fb_info(info);
>  		break;
>  	case FB_EVENT_GET_CONSOLE_MAP:
>  		con2fb = event->data;
> 

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

  reply	other threads:[~2009-01-31 17:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 18:37 Andrey Borzenkov
2009-01-29  9:10 ` [Linux-fbdev-devel] " Geert Uytterhoeven
2009-01-29 10:03   ` Andrea Righi
2009-01-30  4:15   ` Andrey Borzenkov
2009-01-30 10:23     ` Andrea Righi
2009-01-31 15:53       ` Andrea Righi
2009-01-31 16:05         ` Andrey Borzenkov
2009-01-31 17:09     ` Andrea Righi
2009-01-31 17:44       ` Geert Uytterhoeven [this message]
2009-01-31 18:11         ` Andrea Righi
2009-02-01  7:15       ` Andrey Borzenkov
2009-02-01 22:50         ` Andrea Righi
2009-02-02 17:36           ` Andrey Borzenkov
2009-02-03 10:09             ` Andrea Righi
2009-02-04  8:19               ` Andrey Borzenkov
2009-02-04 21:46               ` [PATCH -mmotm] fbmem: fix fb_info->lock and mm->mmap_sem circular locking dependency Andrea Righi
2009-02-04 23:58                 ` Rafael J. Wysocki
2009-02-05  1:49                   ` Rafael J. Wysocki
2009-03-22 14:48                 ` Andrey Borzenkov
2009-03-22 17:57                   ` Rafael J. Wysocki
2009-03-22 21:52                     ` Andrew Morton
2009-04-06 18:47                       ` commit 66c1ca breaks fbdev mode switching Krzysztof Helt
2009-04-06 21:45                         ` Andrea Righi
2009-04-07  9:17                           ` Geert Uytterhoeven
2009-04-07  9:54                             ` Andrea Righi

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=Pine.LNX.4.64.0901311843450.21273@anakin \
    --to=geert@linux-m68k.org \
    --cc=adaplas@gmail.com \
    --cc=arvidjaar@mail.ru \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=righi.andrea@gmail.com \
    /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

all inboxes | Powered by JetHome®