From: David Miller <davem@davemloft.net>
To: herbert@gondor.apana.org.au
Cc: mmokrejs@ribosome.natur.cuni.cz, akpm@linux-foundation.org,
netdev@vger.kernel.org, bugme-daemon@bugzilla.kernel.org,
vegard.nossum@gmail.com, a.p.zijlstra@chello.nl,
jarkao2@gmail.com
Subject: Re: [Bugme-new] [Bug 12515] New: possible circular locking #0: (sk_lock-AF_PACKET){--..}, at: [<c1279838>] sock_setsockopt+0x12b/0x4a4
Date: Fri, 30 Jan 2009 14:13:00 -0800 (PST) [thread overview]
Message-ID: <20090130.141300.120552244.davem@davemloft.net> (raw)
In-Reply-To: <20090130124947.GA6886@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 30 Jan 2009 23:49:47 +1100
> packet: Avoid lock_sock in mmap handler
>
> As the mmap handler gets called under mmap_sem, and we may grab
> mmap_sem elsewhere under the socket lock to access user data, we
> should avoid grabbing the socket lock in the mmap handler.
>
> Since the only thing we care about in the mmap handler is for
> pg_vec* to be invariant, i.e., to exclude packet_set_ring, we
> can achieve this by simply using sk_receive_queue.lock.
>
> I resisted the temptation to create a new spin lock because the
> mmap path isn't exactly common.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Looks good, applied.
I rewrote the commit message as follows so that it actually
matches what happens in the fix ;-)
--------------------
packet: Avoid lock_sock in mmap handler
As the mmap handler gets called under mmap_sem, and we may grab
mmap_sem elsewhere under the socket lock to access user data, we
should avoid grabbing the socket lock in the mmap handler.
Since the only thing we care about in the mmap handler is for
pg_vec* to be invariant, i.e., to exclude packet_set_ring, we
can achieve this by simply using a new mutex.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
prev parent reply other threads:[~2009-01-30 22:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-12515-10286@http.bugzilla.kernel.org/>
2009-01-27 21:43 ` [Bugme-new] [Bug 12515] New: possible circular locking #0: (sk_lock-AF_PACKET){--..}, at: [<c1279838>] sock_setsockopt+0x12b/0x4a4 Andrew Morton
2009-01-27 21:53 ` Martin MOKREJŠ
2009-01-28 1:15 ` Martin MOKREJŠ
2009-01-30 12:49 ` Herbert Xu
2009-01-30 13:56 ` Jarek Poplawski
2009-01-30 22:01 ` Herbert Xu
2009-01-30 22:05 ` David Miller
2009-01-30 17:17 ` Martin MOKREJŠ
2009-01-30 22:13 ` David Miller [this message]
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=20090130.141300.120552244.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=bugme-daemon@bugzilla.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=jarkao2@gmail.com \
--cc=mmokrejs@ribosome.natur.cuni.cz \
--cc=netdev@vger.kernel.org \
--cc=vegard.nossum@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;
as well as URLs for NNTP newsgroup(s).