Revision 712f3147aee0fbbbbed2da20b21b272c5505125e authored by Linus Torvalds on 13 May 2011, 23:16:41 UTC, committed by Linus Torvalds on 14 May 2011, 17:23:44 UTC
When a register_framebuffer() call results in us removing old
conflicting framebuffers, the new registration_lock doesn't protect that
situation.  And we can't just add the same locking to the function,
because these functions call each other: register_framebuffer() calls
remove_conflicting_framebuffers, which in turn calls
unregister_framebuffer for any conflicting entry.

In order to fix it, this just creates wrapper functions around all three
functions and makes the versions that actually do the work be called
"do_xxx()", leaving just the wrapper that gets the lock and calls the
worker function.

So the rule becomes simply that "do_xxxx()" has to be called with the
lock held, and now do_register_framebuffer() can just call
do_remove_conflicting_framebuffers(), and that in turn can call
_do_unregister_framebuffer(), and there is no deadlock, and we can hold
the registration lock over the whole sequence, fixing the races.

It also makes error cases simpler, and fixes one situation where we
would return from unregister_framebuffer() without releasing the lock,
pointed out by Bruno Prémont.

Tested-by: Bruno Prémont <bonbons@linux-vserver.org>
Tested-by: Anca Emanuel <anca.emanuel@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c47747f
Raw File
Kconfig
#
# 802.1d Ethernet Bridging
#

config BRIDGE
	tristate "802.1d Ethernet Bridging"
	select LLC
	select STP
	depends on IPV6 || IPV6=n
	---help---
	  If you say Y here, then your Linux box will be able to act as an
	  Ethernet bridge, which means that the different Ethernet segments it
	  is connected to will appear as one Ethernet to the participants.
	  Several such bridges can work together to create even larger
	  networks of Ethernets using the IEEE 802.1 spanning tree algorithm.
	  As this is a standard, Linux bridges will cooperate properly with
	  other third party bridge products.

	  In order to use the Ethernet bridge, you'll need the bridge
	  configuration tools; see <file:Documentation/networking/bridge.txt>
	  for location. Please read the Bridge mini-HOWTO for more
	  information.

	  If you enable iptables support along with the bridge support then you
	  turn your bridge into a bridging IP firewall.
	  iptables will then see the IP packets being bridged, so you need to
	  take this into account when setting up your firewall rules.
	  Enabling arptables support when bridging will let arptables see
	  bridged ARP traffic in the arptables FORWARD chain.

	  To compile this code as a module, choose M here: the module
	  will be called bridge.

	  If unsure, say N.

config BRIDGE_IGMP_SNOOPING
	bool "IGMP/MLD snooping"
	depends on BRIDGE
	depends on INET
	default y
	---help---
	  If you say Y here, then the Ethernet bridge will be able selectively
	  forward multicast traffic based on IGMP/MLD traffic received from
	  each port.

	  Say N to exclude this support and reduce the binary size.

	  If unsure, say Y.
back to top