diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index bc922724d0..eaa4099fa2 100644 --- a/lib/vhost/vhost.c +++ b/lib/vhost/vhost.c @@ -712,6 +712,7 @@ static void * session_shutdown(void *arg) { struct spdk_vhost_dev *vdev = NULL; + char path[PATH_MAX]; int i; for (i = 0; i < MAX_VHOST_DEVICES; i++) { @@ -719,7 +720,15 @@ session_shutdown(void *arg) if (vdev == NULL) { continue; } - rte_vhost_driver_unregister(vdev->name); + + if (snprintf(path, sizeof(path), "%s%s", dev_dirname, vdev->name) >= (int)sizeof(path)) { + SPDK_ERRLOG("Resulting socket path for controller %s is too long: %s%s\n", vdev->name, dev_dirname, + vdev->name); + assert(false); + continue; + } + + rte_vhost_driver_unregister(path); } SPDK_NOTICELOG("Exiting\n");