]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitdc83d9fa8fdb8759aa263e10da1f8ed2eafad3a8
tree93aa0f83a70f704e33ed378b2ad4636533bd7bde
parent2a839f3a65bd699e4b00227158efe00ec3e246ee
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