[dpdk-dev,v2,2/4] vhost: check that a device exists during reset_owner

Message ID 1445247869-713-3-git-send-email-jerome.jutteau@outscale.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Jerome Jutteau Oct. 19, 2015, 9:44 a.m. UTC
  virtio-net search for it's device in reset_owner.
The function don't check the return result of get_config_ll_entry
which can be NULL.

Signed-off-by: Jerome Jutteau <jerome.jutteau@outscale.com>
---
 lib/librte_vhost/virtio-net.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 955a29d..ec6a575 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -402,6 +402,8 @@  reset_owner(struct vhost_device_ctx ctx)
 	uint64_t device_fh;
 
 	ll_dev = get_config_ll_entry(ctx);
+	if (ll_dev == NULL)
+		return -1;
 	device_fh = ll_dev->dev.device_fh;
 
 	cleanup_device(&ll_dev->dev);