Skip to content
Commit 0f16bc13 authored by Gao Feng's avatar Gao Feng Committed by David S. Miller
Browse files

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: default avatarGao Feng <fgao@ikuai8.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93a205ee
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment