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: <1d1189a3acd8473fadc420d902fd4692@EX13D32EUC003.ant.amazon.com>
Date:   Mon, 23 Dec 2019 11:46:29 +0000
From:   "Durrant, Paul" <pdurrant@...zon.com>
To:     Wei Liu <wei.liu@...nel.org>
CC:     "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Paul Durrant <paul@....org>,
        "David S. Miller" <davem@...emloft.net>
Subject: RE: [PATCH net-next] xen-netback: support dynamic unbind/bind

> -----Original Message-----
> From: Wei Liu <wei.liu@...nel.org>
> Sent: 23 December 2019 11:36
> To: Durrant, Paul <pdurrant@...zon.com>
> Cc: xen-devel@...ts.xenproject.org; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; Wei Liu <wei.liu@...nel.org>; Paul Durrant
> <paul@....org>; David S. Miller <davem@...emloft.net>
> Subject: Re: [PATCH net-next] xen-netback: support dynamic unbind/bind
> 
> On Mon, Dec 23, 2019 at 09:59:23AM +0000, Paul Durrant wrote:
> [...]
> > diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-
> netback/interface.c
> > index f15ba3de6195..0c8a02a1ead7 100644
> > --- a/drivers/net/xen-netback/interface.c
> > +++ b/drivers/net/xen-netback/interface.c
> > @@ -585,6 +585,7 @@ int xenvif_connect_ctrl(struct xenvif *vif,
> grant_ref_t ring_ref,
> >  	struct net_device *dev = vif->dev;
> >  	void *addr;
> >  	struct xen_netif_ctrl_sring *shared;
> > +	RING_IDX rsp_prod, req_prod;
> >  	int err;
> >
> >  	err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif),
> > @@ -593,7 +594,14 @@ int xenvif_connect_ctrl(struct xenvif *vif,
> grant_ref_t ring_ref,
> >  		goto err;
> >
> >  	shared = (struct xen_netif_ctrl_sring *)addr;
> > -	BACK_RING_INIT(&vif->ctrl, shared, XEN_PAGE_SIZE);
> > +	rsp_prod = READ_ONCE(shared->rsp_prod);
> > +	req_prod = READ_ONCE(shared->req_prod);
> > +
> > +	BACK_RING_ATTACH(&vif->ctrl, shared, rsp_prod, XEN_PAGE_SIZE);
> > +
> > +	err = -EIO;
> > +	if (req_prod - rsp_prod > RING_SIZE(&vif->ctrl))
> > +		goto err_unmap;
> 
> I think it makes more sense to attach the ring after this check has been
> done, but I can see you want to structure code like this to reuse the
> unmap error path.

Looks a little odd, agreed. The reason I did it this way is so that I can use RING_SIZE() rather than having to use __RING_SIZE(); makes the code just a little bit shorter... which reminds me I ought to neaten up blkback similarly.

> 
> So:
> 
> Reviewed-by: Wei Liu <wei.liu@...nel.org>
> 
> Nice work btw.

Thanks :-)

  Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ