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]
Date:   Thu, 21 Feb 2019 10:52:53 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Stefano Brivio <sbrivio@...hat.com>
Cc:     Moshe Shemesh <moshe@...lanox.com>, netdev@...r.kernel.org,
        Stephen Hemminger <sthemmin@...rosoft.com>
Subject: Re: [RFC] rtnetlink: handle multiple vlan tags in set_vf_vlan

On Thu, 21 Feb 2019 19:34:57 +0100
Stefano Brivio <sbrivio@...hat.com> wrote:

> On Thu, 21 Feb 2019 09:54:36 -0800
> Stephen Hemminger <stephen@...workplumber.org> wrote:
> 
> > @@ -2224,13 +2223,15 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
> >  
> >  			len++;
> >  		}
> > -		if (len == 0)
> > -			return -EINVAL;
> >  
> > -		err = ops->ndo_set_vf_vlan(dev, ivvl[0]->vf, ivvl[0]->vlan,
> > -					   ivvl[0]->qos, ivvl[0]->vlan_proto);
> > -		if (err < 0)
> > -			return err;
> > +		err = -EINVAL; /* empty list error */
> > +		for (i = 0; i < len; i++) {
> > +			err = ops->ndo_set_vf_vlan(dev, ivvl[i]->vf,
> > +						   ivvl[i]->vlan, ivvl[i]->qos,
> > +						   ivvl[i]->vlan_proto);
> > +			if (err < 0)
> > +				return err;
> > +		}  
> 
> I think the:
> 
> 	if (err < 0)
> 		return err;
> 
> should be outside the loop (with a "break;" inside), otherwise you won't
> return anymore if len == 0.
> 

Your right with empty list it would fall through and look at other attributes
which could overwrite err.

Powered by blists - more mailing lists