]> git.karo-electronics.de Git - karo-tx-linux.git/commit
packet: Avoid lock_sock in mmap handler
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Jan 2009 22:12:06 +0000 (14:12 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Feb 2009 17:28:56 +0000 (09:28 -0800)
commitb5934d35aceba7534aca1e37000753d74919d867
tree62ea8fdd6333b93e1779cdfc573d6a629d85701f
parent3cb569832d1b79a60b5df1b510c1712aa76e7cdd
packet: Avoid lock_sock in mmap handler

[ Upstream commit 905db44087855e3c1709f538ecdc22fd149cadd8 ]

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>
Tested-by: Martin MOKREJŠ <mmokrejs@ribosome.natur.cuni.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/packet/af_packet.c