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: <365233C7-0C33-45E0-9EAD-4E9F89E94BDC@oracle.com>
Date:   Sun, 2 Sep 2018 11:34:26 +0300
From:   Liran Alon <liran.alon@...cle.com>
To:     YueHaibing <yuehaibing@...wei.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Sridhar Samudrala <sridhar.samudrala@...el.com>,
        Stephen Hemminger <stephen@...workplumber.org>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Alexander Duyck <alexander.h.duyck@...el.com>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        Joao Martins <joao.m.martins@...cle.com>,
        netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next] failover: Add missing check to validate
 'slave_dev' in net_failover_slave_unregister



> On 1 Sep 2018, at 6:06, YueHaibing <yuehaibing@...wei.com> wrote:
> 
> Fixes gcc '-Wunused-but-set-variable' warning:
> 
> drivers/net/net_failover.c: In function 'net_failover_slave_unregister':
> drivers/net/net_failover.c:598:35: warning:
> variable 'primary_dev' set but not used [-Wunused-but-set-variable]
> 
> There should check the validity of 'slave_dev'.
> 
> Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
> Suggested-by: Samudrala, Sridhar <sridhar.samudrala@...el.com>
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> ---
> drivers/net/net_failover.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
> index 7ae1856..af1ece8 100644
> --- a/drivers/net/net_failover.c
> +++ b/drivers/net/net_failover.c
> @@ -602,6 +602,9 @@ static int net_failover_slave_unregister(struct net_device *slave_dev,
> 	nfo_info = netdev_priv(failover_dev);
> 	primary_dev = rtnl_dereference(nfo_info->primary_dev);
> 	standby_dev = rtnl_dereference(nfo_info->standby_dev);
> +
> +	if (slave_dev != primary_dev && slave_dev != standby_dev)
> +		return -ENODEV;

As this condition signals a bug, I think we should instead:
if (WARN_ON_ONCE((slave_dev != primary_dev) && (slave_dev != standby_dev))
    return -ENODEV;

> 
> 	vlan_vids_del_by_dev(slave_dev, failover_dev);
> 	dev_uc_unsync(slave_dev, failover_dev);
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ