All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] virtio/s390: one bugfix
@ 2015-09-10 14:35 Cornelia Huck
  2015-09-10 14:35 ` [PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw Cornelia Huck
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Cornelia Huck @ 2015-09-10 14:35 UTC (permalink / raw)
  To: mst; +Cc: borntraeger, linux-s390, kvm, virtualization

Michael,

here's a bugfix for the virtio-ccw driver.

Question: How would you like to get patches? This one is formatted
against your current linux-next branch; I can prepare a branch for
you to pull from as well.

Pierre Morel (1):
  virtio/s390: handle failures of READ_VQ_CONF ccw

 drivers/s390/virtio/virtio_ccw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.3.8

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw
  2015-09-10 14:35 [PATCH 0/1] virtio/s390: one bugfix Cornelia Huck
  2015-09-10 14:35 ` [PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw Cornelia Huck
@ 2015-09-10 14:35 ` Cornelia Huck
  2015-09-10 14:58 ` [PATCH 0/1] virtio/s390: one bugfix Michael S. Tsirkin
  2015-09-10 14:58 ` Michael S. Tsirkin
  3 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2015-09-10 14:35 UTC (permalink / raw)
  To: mst
  Cc: borntraeger, virtualization, linux-s390, kvm, Pierre Morel,
	Cornelia Huck

From: Pierre Morel <pmorel@linux.vnet.ibm.com>

In virtio_ccw_read_vq_conf() the return value of ccw_io_helper()
was not checked.
If the configuration could not be read properly, we'd wrongly assume a
queue size of 0.

Let's propagate any I/O error to virtio_ccw_setup_vq() so it may
properly fail.

Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 drivers/s390/virtio/virtio_ccw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index f8d8fdb..e9fae30 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -400,12 +400,16 @@ static bool virtio_ccw_kvm_notify(struct virtqueue *vq)
 static int virtio_ccw_read_vq_conf(struct virtio_ccw_device *vcdev,
 				   struct ccw1 *ccw, int index)
 {
+	int ret;
+
 	vcdev->config_block->index = index;
 	ccw->cmd_code = CCW_CMD_READ_VQ_CONF;
 	ccw->flags = 0;
 	ccw->count = sizeof(struct vq_config_block);
 	ccw->cda = (__u32)(unsigned long)(vcdev->config_block);
-	ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_VQ_CONF);
+	ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_VQ_CONF);
+	if (ret)
+		return ret;
 	return vcdev->config_block->num;
 }
 
@@ -503,6 +507,10 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 		goto out_err;
 	}
 	info->num = virtio_ccw_read_vq_conf(vcdev, ccw, i);
+	if (info->num < 0) {
+		err = info->num;
+		goto out_err;
+	}
 	size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
 	info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
 	if (info->queue == NULL) {
-- 
2.3.8

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw
  2015-09-10 14:35 [PATCH 0/1] virtio/s390: one bugfix Cornelia Huck
@ 2015-09-10 14:35 ` Cornelia Huck
  2015-09-10 14:35 ` Cornelia Huck
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2015-09-10 14:35 UTC (permalink / raw)
  To: mst; +Cc: linux-s390, kvm, Pierre Morel, virtualization, borntraeger

From: Pierre Morel <pmorel@linux.vnet.ibm.com>

In virtio_ccw_read_vq_conf() the return value of ccw_io_helper()
was not checked.
If the configuration could not be read properly, we'd wrongly assume a
queue size of 0.

Let's propagate any I/O error to virtio_ccw_setup_vq() so it may
properly fail.

Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 drivers/s390/virtio/virtio_ccw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index f8d8fdb..e9fae30 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -400,12 +400,16 @@ static bool virtio_ccw_kvm_notify(struct virtqueue *vq)
 static int virtio_ccw_read_vq_conf(struct virtio_ccw_device *vcdev,
 				   struct ccw1 *ccw, int index)
 {
+	int ret;
+
 	vcdev->config_block->index = index;
 	ccw->cmd_code = CCW_CMD_READ_VQ_CONF;
 	ccw->flags = 0;
 	ccw->count = sizeof(struct vq_config_block);
 	ccw->cda = (__u32)(unsigned long)(vcdev->config_block);
-	ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_VQ_CONF);
+	ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_VQ_CONF);
+	if (ret)
+		return ret;
 	return vcdev->config_block->num;
 }
 
@@ -503,6 +507,10 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
 		goto out_err;
 	}
 	info->num = virtio_ccw_read_vq_conf(vcdev, ccw, i);
+	if (info->num < 0) {
+		err = info->num;
+		goto out_err;
+	}
 	size = PAGE_ALIGN(vring_size(info->num, KVM_VIRTIO_CCW_RING_ALIGN));
 	info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
 	if (info->queue == NULL) {
-- 
2.3.8

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/1] virtio/s390: one bugfix
  2015-09-10 14:35 [PATCH 0/1] virtio/s390: one bugfix Cornelia Huck
  2015-09-10 14:35 ` [PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw Cornelia Huck
  2015-09-10 14:35 ` Cornelia Huck
@ 2015-09-10 14:58 ` Michael S. Tsirkin
  2015-09-10 14:58 ` Michael S. Tsirkin
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2015-09-10 14:58 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: borntraeger, virtualization, linux-s390, kvm

On Thu, Sep 10, 2015 at 04:35:07PM +0200, Cornelia Huck wrote:
> Michael,
> 
> here's a bugfix for the virtio-ccw driver.
> 
> Question: How would you like to get patches? This one is formatted
> against your current linux-next branch; I can prepare a branch for
> you to pull from as well.

No need, patches are fine.

> Pierre Morel (1):
>   virtio/s390: handle failures of READ_VQ_CONF ccw
> 
>  drivers/s390/virtio/virtio_ccw.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> -- 
> 2.3.8

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/1] virtio/s390: one bugfix
  2015-09-10 14:35 [PATCH 0/1] virtio/s390: one bugfix Cornelia Huck
                   ` (2 preceding siblings ...)
  2015-09-10 14:58 ` [PATCH 0/1] virtio/s390: one bugfix Michael S. Tsirkin
@ 2015-09-10 14:58 ` Michael S. Tsirkin
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2015-09-10 14:58 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: borntraeger, linux-s390, kvm, virtualization

On Thu, Sep 10, 2015 at 04:35:07PM +0200, Cornelia Huck wrote:
> Michael,
> 
> here's a bugfix for the virtio-ccw driver.
> 
> Question: How would you like to get patches? This one is formatted
> against your current linux-next branch; I can prepare a branch for
> you to pull from as well.

No need, patches are fine.

> Pierre Morel (1):
>   virtio/s390: handle failures of READ_VQ_CONF ccw
> 
>  drivers/s390/virtio/virtio_ccw.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> -- 
> 2.3.8

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-10 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-10 14:35 [PATCH 0/1] virtio/s390: one bugfix Cornelia Huck
2015-09-10 14:35 ` [PATCH 1/1] virtio/s390: handle failures of READ_VQ_CONF ccw Cornelia Huck
2015-09-10 14:35 ` Cornelia Huck
2015-09-10 14:58 ` [PATCH 0/1] virtio/s390: one bugfix Michael S. Tsirkin
2015-09-10 14:58 ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.