[dpdk-dev,v2] net/virtio-user: fix segfault as features change

Message ID 1516701163-132843-1-git-send-email-jianfeng.tan@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Yuanhan Liu
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Jianfeng Tan Jan. 23, 2018, 9:52 a.m. UTC
  Since commit 59fe5e17d930 ("vhost: propagate set features handling error"),
vhost does not allow to set different features without reset.

The virito-user driver fails to reset the device in below commit.

To fix, we send the reset message as stopping the device.

Fixes: c12a26ee209e ("net/virtio-user: fix not properly reset device")

Reported-by: Lei Yao <lei.a.yao@intel.com>
Reported-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
 v2: Correct commit reference number format.
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Yuanhan Liu Jan. 26, 2018, 3:20 p.m. UTC | #1
On Tue, Jan 23, 2018 at 09:52:43AM +0000, Jianfeng Tan wrote:
> Since commit 59fe5e17d930 ("vhost: propagate set features handling error"),
> vhost does not allow to set different features without reset.
> 
> The virito-user driver fails to reset the device in below commit.
> 
> To fix, we send the reset message as stopping the device.
> 
> Fixes: c12a26ee209e ("net/virtio-user: fix not properly reset device")
> 
> Reported-by: Lei Yao <lei.a.yao@intel.com>
> Reported-by: Tiwei Bie <tiwei.bie@intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>

Applied to dpdk-next-virtio.

Thanks.

	--yliu
  

Patch

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 7a70c18..3b5f737 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -142,6 +142,11 @@  int virtio_user_stop_device(struct virtio_user_dev *dev)
 	for (i = 0; i < dev->max_queue_pairs; ++i)
 		dev->ops->enable_qp(dev, i, 0);
 
+	if (dev->ops->send_request(dev, VHOST_USER_RESET_OWNER, NULL) < 0) {
+		PMD_DRV_LOG(INFO, "Failed to reset the device\n");
+		return -1;
+	}
+
 	return 0;
 }