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: <f7td1g49m8n.fsf@redhat.com>
Date:   Tue, 03 Jan 2017 10:50:00 -0500
From:   Aaron Conole <aconole@...hat.com>
To:     Krister Johansen <kjlx@...pleofstupid.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Mahesh Bandewar <maheshb@...gle.com>, netdev@...r.kernel.org
Subject: Re: [PATCH] Ipvlan should return an error when an address is already in use.

Hi Krister,

Krister Johansen <kjlx@...pleofstupid.com> writes:

> The ipvlan code already knows how to detect when a duplicate address is
> about to be assigned to an ipvlan device.  However, that failure is not
> propogated outward and leads to a silent failure.  This teaches the ip
> address addition functions how to report this error to the user
> applications so that a notifier chain failure during ip address addition
> will not appear to succeed when it actually has not.
>
> This can be especially useful if it is necessary to provision many
> ipvlans in containers.  The provisioning software (or operator) can use
> this to detect situations where an ip address is unexpectedly in use.
>
> Signed-off-by: Krister Johansen <kjlx@...pleofstupid.com>
> ---

...

> @@ -489,7 +490,12 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
>  	   Notifier will trigger FIB update, so that
>  	   listeners of netlink will know about new ifaddr */
>  	rtmsg_ifa(RTM_NEWADDR, ifa, nlh, portid);
> -	blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
> +	ret = blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);

Why are you doing this assignment if you aren't using the result?

> +	ret = notifier_to_errno(ret);
> +	if (ret) {
> +		__inet_del_ifa(in_dev, ifap, 1, NULL, portid);
> +		return ret;
> +	}
>  
>  	return 0;
>  }

<<snip>>

> @@ -1031,9 +1032,15 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
>  out2:
>  	rcu_read_unlock_bh();
>  
> -	if (likely(err == 0))
> -		inet6addr_notifier_call_chain(NETDEV_UP, ifa);
> -	else {
> +	if (likely(err == 0)) {
> +		err = inet6addr_notifier_call_chain(NETDEV_UP, ifa);

Same here...

> +		err = notifier_to_errno(err);
> +		if (err) {
> +			__ipv6_del_addr(ifa, false);
> +			ifa = ERR_PTR(err);
> +			return ifa;
> +		}
> +	} else {
>  		kfree(ifa);
>  		ifa = ERR_PTR(err);
>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ