[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5c58ba54-9c37-0f4a-b68c-c15ed7008d3c@cogentembedded.com>
Date: Fri, 21 Oct 2016 13:50:12 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: fgao@...ai8.com, davem@...emloft.net, jasowang@...hat.com,
edumazet@...gle.com, pabeni@...hat.com, netdev@...r.kernel.org
Cc: gfree.wind@...il.com
Subject: Re: [PATCH net-next 1/1] driver: tun: Forbid to set IFF_TUN and
IFF_TAP at the same time
Hello.
On 10/21/2016 9:14 AM, fgao@...ai8.com wrote:
> From: Gao Feng <fgao@...ai8.com>
>
> Current tun driver permits the ifr_flags is set with IFF_TUN and
> IFF_TAP at the same time. But actually there is only IFF_TUN flag
> works. And it does not make sense these two flags are set, so add
> this check.
>
> Signed-off-by: Gao Feng <fgao@...ai8.com>
> ---
> drivers/net/tun.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 8093e39..c1f89c1 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1752,6 +1752,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
> if (err < 0)
> return err;
>
> + if ((ifr->ifr_flags & (IFF_TUN | IFF_TAP)) == (IFF_TUN | IFF_TAP)) {
> + return -EINVAL;
> + }
{} not needed here.
MBR, Sergei
Powered by blists - more mailing lists