Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tree: fix segfault in nvme_free_tree()
Commands like nvme list & list-subsys currently segfault for --help or any invalid command option as shown below: nvme list -h Usage: nvme list <device> [OPTIONS] Retrieve basic information for all NVMe namespaces Options: [ --verbose, -v ] --- output verbosity [ --output-format=<FMT>, -o <FMT> ] --- format: normal|json|binary Segmentation fault (core dumped) This is due to an invalid dereferencing of the nvme_root_t object in nvme_free_tree(). Fix this by checking whether this object is valid before dereferencing and freeing it. And while we are it, ensure r->options is also valid before freeing it. Signed-off-by: Martin George <marting@netapp.com>
- Loading branch information