Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree: fix segfault in nvme_free_tree() #855

Merged
merged 1 commit into from
Jul 1, 2024

Commits on Jul 1, 2024

  1. 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>
    martin-gpy authored and igaw committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    6d3dbd9 View commit details
    Browse the repository at this point in the history