]> git.baikalelectronics.ru Git - kernel.git/commit
driver: tun: Move tun check into the block of TUNSETIFF condition check
authorGao Feng <fgao@ikuai8.com>
Tue, 25 Oct 2016 14:26:09 +0000 (22:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Oct 2016 18:51:42 +0000 (14:51 -0400)
commitf7fc44576abfcbdbc174eef1894d495a2b6a5e4b
tree5d78ddca868f0146e7ae379221afede07958eaa1
parent60b0c58aa4503aef4b462baeab15de8b456390d0
driver: tun: Move tun check into the block of TUNSETIFF condition check

When cmd is TUNSETIFF and tun is not null, the original codes go ahead,
then reach the default case of switch(cmd) and set the ret is -EINVAL.
It is not clear for readers.

Now move the tun check into the block of TUNSETIFF condition check, and
return -EEXIST instead of -EINVAL when the tfile already owns one tun.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c