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

Jerome Jutteau jerome.jutteau at outscale.com
Mon Oct 19 11:44:27 CEST 2015


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 at outscale.com>
---
 lib/librte_vhost/virtio-net.c | 2 ++
 1 file changed, 2 insertions(+)

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);
-- 
jerome



More information about the dev mailing list