Need to destroy allocated device if application fails to
add new connection or we have fdset failure.
Fixes:
acbff5c67ea7 ("vhost: fix crash when exceeding file descriptors")
Fixes:
efba12a78ddf ("vhost: add user callbacks for socket open/close")
Cc: stable@dpdk.org
Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
RTE_LOG(ERR, VHOST_CONFIG,
"failed to add vhost user connection with fd %d\n",
fd);
- goto err;
+ goto err_cleanup;
}
}
if (vsocket->notify_ops->destroy_connection)
vsocket->notify_ops->destroy_connection(conn->vid);
- goto err;
+ goto err_cleanup;
}
pthread_mutex_lock(&vsocket->conn_mutex);
fdset_pipe_notify(&vhost_user.fdset);
return;
+err_cleanup:
+ vhost_destroy_device(vid);
err:
free(conn);
close(fd);