lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8dce2bc-62f7-7a66-d25c-aee5275f3a7f@gmail.com>
Date:   Wed, 24 Jan 2018 10:29:46 -0700
From:   David Ahern <dsahern@...il.com>
To:     Eric Dumazet <eric.dumazet@...il.com>, netdev@...r.kernel.org
Cc:     yoshfuji@...ux-ipv6.org, idosch@...lanox.com,
        roopa@...ulusnetworks.com
Subject: Re: [PATCH v2 net-next] net/ipv6: Do not allow route add with a
 device that is down

On 1/24/18 10:23 AM, Eric Dumazet wrote:
> On Wed, 2018-01-24 at 08:29 -0800, David Ahern wrote:
>> IPv6 allows routes to be installed when the device is not up (admin up).
>> Worse, it does not mark it as LINKDOWN. IPv4 does not allow it and really
>> there is no reason for IPv6 to allow it, so check the flags and deny if
>> device is admin down.
>>
>> Signed-off-by: David Ahern <dsahern@...il.com>
>> ---
>> v2
>> - missed setting err to -ENETDOWN (thanks for catching that Roopa)
>>
>>  net/ipv6/route.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index f85da2f1e729..4e8fab766018 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -2734,6 +2734,12 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,
>>  	if (!dev)
>>  		goto out;
>>  
>> +	err = -ENETDOWN;
>> +	if (!(dev->flags & IFF_UP)) {
>> +		NL_SET_ERR_MSG(extack, "Nexthop device is not up");
>> +		goto out;
>> +	}
> 
> 
> Note that since you have to take a branch, you can move the 
> err = -ENETDOWN inside the branch.
> 
> The trick of setting err before doing :
> 
> if (cond)
>    goto xxxx;
> 
> Is only relevant if the goto is naked.

yes, i was tempted to put it inside the brackets, but recall in the past
some reviewers have strong opinions about it being set first. I can move it.

> 
> By looking at your patch without more context, it is not clear that the
> "err = -ENETDOWN" has no side effect.
> 

It doesn't. only 1 error path after this code and it sets err.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ