[IPVS]: Fix sched registration race when checking for name collision.
authorPavel Emelyanov <xemul@openvz.org>
Tue, 4 Dec 2007 08:45:06 +0000 (00:45 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 5 Dec 2007 13:37:27 +0000 (05:37 -0800)
commit4ac63ad6c52e9cdefbcb54ec4575ab12b78b49d9
treee8ff9d5a9bbe01c68a95f71f1707cc24afa770d1
parenta014bc8f0f0a3a0cac4fef656f101cdfb77b71eb
[IPVS]: Fix sched registration race when checking for name collision.

The register_ip_vs_scheduler() checks for the scheduler with the
same name under the read-locked __ip_vs_sched_lock, then drops,
takes it for writing and puts the scheduler in list.

This is racy, since we can have a race window between the lock
being re-locked for writing.

The fix is to search the scheduler with the given name right under
the write-locked __ip_vs_sched_lock.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipvs/ip_vs_sched.c