diff options
author | YueHaibing <yuehaibing@huawei.com> | 2018-09-04 05:56:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-13 22:08:28 +0300 |
commit | f60d53ef5755b8fefc9d11fc6136b79fb0a4a25c (patch) | |
tree | ae2f235c0b29ad38d06e12b38dd3bd6776a81f34 /drivers/net | |
parent | e12da4273c6bb59d21ca328d3a4e87d6adeb421f (diff) | |
download | linux-f60d53ef5755b8fefc9d11fc6136b79fb0a4a25c.tar.xz |
failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister
[ Upstream commit 9e7e6cabf371cc008cb2244a04c012b516753693 ]
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")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/net_failover.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c index 7ae1856d1f18..5a749dc25bec 100644 --- a/drivers/net/net_failover.c +++ b/drivers/net/net_failover.c @@ -603,6 +603,9 @@ static int net_failover_slave_unregister(struct net_device *slave_dev, primary_dev = rtnl_dereference(nfo_info->primary_dev); standby_dev = rtnl_dereference(nfo_info->standby_dev); + 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); dev_mc_unsync(slave_dev, failover_dev); |