public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andrea Righi <righi.andrea@gmail.com>
Cc: hannes@cmpxchg.org, davej@redhat.com, rjw@sisk.pl,
	hannes@saeurebad.de, krzysztof.h1@wp.pl,
	harvey.harrison@gmail.com, stefanr@s5r6.in-berlin.de,
	linux-kernel@vger.kernel.org, righi.andrea@gmail.com
Subject: Re: [PATCH] fbmem: copy_from/to_user() with mutex held (v3)
Date: Tue, 27 Jan 2009 12:52:55 -0800	[thread overview]
Message-ID: <20090127125255.ea9c0d40.akpm@linux-foundation.org> (raw)
In-Reply-To: <1232443676-7037-1-git-send-email-righi.andrea@gmail.com>

On Tue, 20 Jan 2009 10:27:56 +0100
Andrea Righi <righi.andrea@gmail.com> wrote:

> Avoid to call copy_from/to_user() with fb_info->lock mutex held in fbmem
> ioctl().
> 
> fb_mmap() is called under mm->mmap_sem (A) held, that also acquires
> fb_info->lock (B); fb_ioctl() takes fb_info->lock (B) and does
> copy_from/to_user() that might acquire mm->mmap_sem (A), causing a
> deadlock.
> 
> NOTE: it doesn't push down the fb_info->lock in each own driver's
> fb_ioctl(), so there're still potential deadlocks somewhere.
> 

Looks good to me.

> ...
>
>  static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> -__acquires(&info->lock)
> -__releases(&info->lock)

Should the __acquires/__releases annotation be relocated to
do_fb_ioctl()?  I've never actually got down and understood those
things.



  reply	other threads:[~2009-01-27 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20  9:27 [PATCH] fbmem: copy_from/to_user() with mutex held (v3) Andrea Righi
2009-01-27 20:52 ` Andrew Morton [this message]
2009-01-27 21:29   ` Harvey Harrison

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=20090127125255.ea9c0d40.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=hannes@saeurebad.de \
    --cc=harvey.harrison@gmail.com \
    --cc=krzysztof.h1@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=righi.andrea@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=stefanr@s5r6.in-berlin.de \
    /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