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, 5 Aug 2021 17:33:35 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     "David S . Miller" <davem@...emloft.net>,
        linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v1] netdevsim: Forbid devlink reload when adding
 or deleting ports

On Thu, Aug 05, 2021 at 07:23:42AM -0700, Jakub Kicinski wrote:
> On Thu, 5 Aug 2021 16:51:31 +0300 Leon Romanovsky wrote:
> > > > +	nsim_bus_dev = nsim_dev->nsim_bus_dev;
> > > > +	if (!mutex_trylock(&nsim_bus_dev->nsim_bus_reload_lock))
> > > > +		return -EOPNOTSUPP;  
> > > 
> > > Why not -EBUSY?  
> > 
> > This is what devlink_reload_disable() returns, so I kept same error.
> > It is not important at all.
> > 
> > What about the following change on top of this patch?
> 
> LGTM, the only question is whether we should leave in_reload true 
> if nsim_dev->fail_reload is set.

I don't think so, it will block add/delete ports.

> 
> > @@ -889,17 +890,26 @@ static int nsim_dev_reload_up(struct devlink *devlink, enum devlink_reload_actio
> >  			      struct netlink_ext_ack *extack)
> >  {
> >  	struct nsim_dev *nsim_dev = devlink_priv(devlink);
> > +	struct nsim_bus_dev *nsim_bus_dev;
> > +	int ret;
> > +
> > +	nsim_bus_dev = nsim_dev->nsim_bus_dev;
> > +	mutex_lock(&nsim_bus_dev->nsim_bus_reload_lock);
> > +	nsim_bus_dev->in_reload = false;
> >  
> >  	if (nsim_dev->fail_reload) {
> >  		/* For testing purposes, user set debugfs fail_reload
> >  		 * value to true. Fail right away.
> >  		 */
> >  		NL_SET_ERR_MSG_MOD(extack, "User setup the reload to fail for testing purposes");
> > +		mutex_unlock(&nsim_bus_dev->nsim_bus_reload_lock);
> >  		return -EINVAL;
> >  	}
> >  
> >  	*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
> > -	return nsim_dev_reload_create(nsim_dev, extack);
> > +	ret = nsim_dev_reload_create(nsim_dev, extack);
> > +	mutex_unlock(&nsim_bus_dev->nsim_bus_reload_lock);
> > +	return ret;
> >  }
> 
> 

Powered by blists - more mailing lists