Skip to content

Commit 3849139

Browse files
committed
tree: make subsystem name mandatory in nvme_scan_ctrl()
nvme_scan_ctrl() is iterating over sysfs, so any controller must have a corresponding subsystem; not finding one is an error. Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 267dbc2 commit 3849139

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/nvme/tree.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,14 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name)
13671367
return NULL;
13681368
}
13691369
subsysname = nvme_ctrl_lookup_subsystem_name(r, name);
1370-
/* subsysname might be NULL here */
1370+
if (!subsysname) {
1371+
nvme_msg(r, LOG_ERR,
1372+
"failed to lookup subsystem for controller %s\n",
1373+
name);
1374+
free(path);
1375+
errno = ENXIO;
1376+
return NULL;
1377+
}
13711378
s = nvme_lookup_subsystem(h, subsysname, subsysnqn);
13721379
free(subsysnqn);
13731380
free(subsysname);

0 commit comments

Comments
 (0)