Skip to content

Commit bae364f

Browse files
authored
Merge pull request #463 from martin-gpy/authkey_unavailable_segfault
nvme-tree: avoid segfault if auth keys are unavailable
2 parents 9728038 + 2af8a27 commit bae364f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/nvme/tree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,8 @@ static int nvme_configure_ctrl(nvme_root_t r, nvme_ctrl_t c, const char *path,
11841184
c->serial = nvme_get_ctrl_attr(c, "serial");
11851185
c->sqsize = nvme_get_ctrl_attr(c, "sqsize");
11861186
host_key = nvme_get_ctrl_attr(c, "dhchap_secret");
1187-
if (host_key && (!strcmp(c->s->h->dhchap_key, host_key) ||
1187+
if (host_key && c->s && c->s->h && c->s->h->dhchap_key &&
1188+
(!strcmp(c->s->h->dhchap_key, host_key) ||
11881189
!strcmp("none", host_key))) {
11891190
free(host_key);
11901191
host_key = NULL;

0 commit comments

Comments
 (0)