Fio with rbd engine will panic if clustername option is specified but clientname
is not. In that case, o->client_name will be a NULL pointer, strlen(o->client_name) in _fio_rbd_connect() will lead to the segmentation fault.
Signed-off-by: Jevon Qiao <scaleqiao@gmail.com>
char *client_name = NULL;
/*
char *client_name = NULL;
/*
- * If we specify cluser name, the rados_creat2
+ * If we specify cluser name, the rados_create2
* will not assume 'client.'. name is considered
* as a full type.id namestr
*/
* will not assume 'client.'. name is considered
* as a full type.id namestr
*/
- if (!index(o->client_name, '.')) {
- client_name = calloc(1, strlen("client.") +
- strlen(o->client_name) + 1);
- strcat(client_name, "client.");
- o->client_name = strcat(client_name, o->client_name);
+ if (o->client_name) {
+ if (!index(o->client_name, '.')) {
+ client_name = calloc(1, strlen("client.") +
+ strlen(o->client_name) + 1);
+ strcat(client_name, "client.");
+ o->client_name = strcat(client_name,
+ o->client_name);
+ }
}
r = rados_create2(&rbd->cluster, o->cluster_name,
o->client_name, 0);
}
r = rados_create2(&rbd->cluster, o->cluster_name,
o->client_name, 0);