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] [day] [month] [year] [list]
Date:	Mon, 8 Dec 2014 09:30:58 +0200
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	David Hildenbrand <dahi@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org,
	Cornelia Huck <cornelia.huck@...ibm.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	virtualization@...ts.linux-foundation.org,
	Ohad Ben-Cohen <ohad@...ery.com>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	linux390@...ibm.com, Martin Schwidefsky <schwidefsky@...ibm.com>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	Nikhil Rao <nikhil.rao@...el.com>,
	Siva Yerramreddy <yshivakrishna@...il.com>,
	lguest@...ts.ozlabs.org, linux-s390@...r.kernel.org
Subject: Re: [PATCH RFC v2 3/4] virtio: allow finalize_features to fail

On Fri, Dec 05, 2014 at 10:53:54AM +0100, David Hildenbrand wrote:
> > This will make it easy for transports to validate features and return
> > failure.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
> > ---
> >  include/linux/virtio_config.h          | 3 ++-
> >  drivers/lguest/lguest_device.c         | 4 +++-
> >  drivers/misc/mic/card/mic_virtio.c     | 4 +++-
> >  drivers/remoteproc/remoteproc_virtio.c | 4 +++-
> >  drivers/s390/kvm/kvm_virtio.c          | 4 +++-
> >  drivers/s390/kvm/virtio_ccw.c          | 6 ++++--
> >  drivers/virtio/virtio.c                | 4 +++-
> >  drivers/virtio/virtio_mmio.c           | 4 +++-
> >  drivers/virtio/virtio_pci.c            | 4 +++-
> >  9 files changed, 27 insertions(+), 10 deletions(-)
> > 
> > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> > index 1fa5faa..7979f85 100644
> > --- a/include/linux/virtio_config.h
> > +++ b/include/linux/virtio_config.h
> > @@ -47,6 +47,7 @@
> >   *	vdev: the virtio_device
> >   *	This gives the final feature bits for the device: it can change
> >   *	the dev->feature bits if it wants.
> > + *	Returns 0 on success or error status
> 
> "Returns 0 on success, otherwise the error status."

It's what other functions say.
I'm ok with changing this but let's do it in a separate patch.

> >   * @bus_name: return the bus name associated with the device
> >   *	vdev: the virtio_device
> >   *      This returns a pointer to the bus name a la pci_name from which
> > @@ -68,7 +69,7 @@ struct virtio_config_ops {
> >  			const char *names[]);
> >  	void (*del_vqs)(struct virtio_device *);
> >  	u64 (*get_features)(struct virtio_device *vdev);
> > -	void (*finalize_features)(struct virtio_device *vdev);
> > +	int (*finalize_features)(struct virtio_device *vdev);
> >  	const char *(*bus_name)(struct virtio_device *vdev);
> >  	int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
> >  };
> 
> ...
> 
> > 
> >  static void virtio_ccw_get_config(struct virtio_device *vdev,
> > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> > index 6b4c1113..7ddebbc 100644
> > --- a/drivers/virtio/virtio.c
> > +++ b/drivers/virtio/virtio.c
> > @@ -211,7 +211,9 @@ static int virtio_dev_probe(struct device *_d)
> >  		if (device_features & (1ULL << i))
> >  			__virtio_set_bit(dev, i);
> > 
> > -	dev->config->finalize_features(dev);
> > +	err = dev->config->finalize_features(dev);
> > +	if (err)
> > +		goto err;
> > 
> >  	if (virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
> >  		add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK);
> > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> > index aec1dae..5219210 100644
> > --- a/drivers/virtio/virtio_mmio.c
> > +++ b/drivers/virtio/virtio_mmio.c
> > @@ -152,7 +152,7 @@ static u64 vm_get_features(struct virtio_device *vdev)
> >  	return readl(vm_dev->base + VIRTIO_MMIO_HOST_FEATURES);
> >  }
> > 
> 
> Do we have to take care of fails in virtio_device_restore()?
> 
> Otherwise looks good to me.
> 
> David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ