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: <1433148765.15036.79.camel@citrix.com>
Date:	Mon, 1 Jun 2015 09:52:45 +0100
From:	Ian Campbell <ian.campbell@...rix.com>
To:	Wei Liu <wei.liu2@...rix.com>
CC:	<xen-devel@...ts.xen.org>, <netdev@...r.kernel.org>,
	<david.vrabel@...rix.com>
Subject: Re: [PATCH net] xen: netback: read hotplug script once at start of
 day.

On Fri, 2015-05-29 at 18:38 +0100, Wei Liu wrote:
> On Fri, May 29, 2015 at 05:24:53PM +0100, Ian Campbell wrote:
> [...]
> >  	if (be->vif != NULL)
> >  		return 0;
> > @@ -417,12 +409,23 @@ static int backend_create_xenvif(struct backend_info *be)
> >  		return (err < 0) ? err : -EINVAL;
> >  	}
> >  
> > +	script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL);
> > +	if (IS_ERR(script)) {
> > +		int err = PTR_ERR(script);
> > +		xenbus_dev_fatal(dev, err, "reading script");
> > +		return err;
> > +	}
> > +
> >  	vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle);
> >  	if (IS_ERR(vif)) {
> >  		err = PTR_ERR(vif);
> >  		xenbus_dev_fatal(dev, err, "creating interface");
> > +		kfree(script);
> >  		return err;
> >  	}
> > +
> > +	vif->hotplug_script = script;
> > +
> 
> IMO it's better we make xenvif_alloc accept a new parameter called
> "script" then allocate vif->hotplug_script there. Then free
> vif->hotplug_script in xenvif_free. This way it's less error prone
> because all memory allocated for vif is managed in proper place -
> xenvif_alloc and xenvif_free.

Well, except the allocation is still in xenbus_read via
backend_create_xenvif, but yes I think that refactoring would be an
improvement.

What about storing it in struct backend_info and setting/restoring in
netback_{probe,remove}? That might be best of all?

Ian.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ