]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
bonding: fix a race condition in calls to slave MII ioctls
authorJiri Bohac <jbohac@suse.cz>
Thu, 29 Oct 2009 05:23:54 +0000 (22:23 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:22:58 +0000 (16:22 -0800)
commit44791e49b282eb1901b28d27d9756ace8f873dca
tree6dee8d20e2821c8d8019dc9b364b6289e60df09c
parent474ac4951f31a678cda82833c6ec6dbb4b58bacb
bonding: fix a race condition in calls to slave MII ioctls

commit d9d5283228d0c752f199c901fff6e1405dc91bcb upstream.

In mii monitor mode, bond_check_dev_link() calls the the ioctl
handler of slave devices. It stores the ndo_do_ioctl function
pointer to a static (!) ioctl variable and later uses it to call the
handler with the IOCTL macro.

If another thread executes bond_check_dev_link() at the same time
(even with a different bond, which none of the locks prevent), a
race condition occurs. If the two racing slaves have different
drivers, this may result in one driver's ioctl handler being
called with a pointer to a net_device controlled with a different
driver, resulting in unpredictable breakage.

Unless I am overlooking something, the "static" must be a
copy'n'paste error (?).

Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/bonding/bond_main.c