tun: Fix races in tun_set_iff
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 20 Jan 2009 10:57:48 +0000 (10:57 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Jan 2009 00:00:43 +0000 (16:00 -0800)
commita7385ba21102a90f902055f9f185ca02bf62fa43
tree93aa0f83a70f704e33ed378b2ad4636533bd7bde
parent74a3e5a71c9b54c63bff978e9cafbcef67600f0b
tun: Fix races in tun_set_iff

It is possible for two different tasks with access to the same file
descriptor to call tun_set_iff on it at the same time and race to
attach to a tap device.  Prevent this by placing all of the logic to
attach to a file descriptor in one function and testing the file
descriptor to be certain it is not already attached to another tun
device.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
This page took 0.024221 seconds and 5 git commands to generate.