Commit 5bb5c8f
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 <[email protected]>1 parent e42b6a8 commit 5bb5c8f
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
| |||
0 commit comments