fabrics: avoid connect segfault for invalid param#3267
Open
martin-gpy wants to merge 1 commit intolinux-nvme:masterfrom
Open
fabrics: avoid connect segfault for invalid param#3267martin-gpy wants to merge 1 commit intolinux-nvme:masterfrom
martin-gpy wants to merge 1 commit intolinux-nvme:masterfrom
Conversation
The connect command segfaults if one passes an invalid param to it. For e.g. nvme connect disconnect required argument [--nqn | -n] not specified Segmentation fault (core dumped) Running gdb on the core revealed the segfault was due to dereferencing the fctx NULL pointer: Core was generated by `nvme connect disconnect'. Program terminated with signal SIGSEGV, Segmentation fault. libnvmf_context_free (fctx=0x0) at ../libnvme/src/nvme/fabrics.c:222 222 free(fctx->tls_key); (gdb) where libnvmf_context_free (fctx=0x0) at ../libnvme/src/nvme/fabrics.c:222 cleanup_nvmf_context (fctx=0x7ffd6f16ddf8) at ../util/cleanup.h:58 fabrics_connect (desc=<optimized out>, argc=<optimized out>, argv=0x7ffd6f16ee10) at ../fabrics.c:595 handle_plugin (argc=argc@entry=2, argv=argv@entry=0x7ffd6f16ee10, plugin=0x558480 <builtin>) at ../plugin.c:190 main (argc=3, argv=0x7ffd6f16ee08) at ../nvme.c:11313 Fix the same. Fixes: 27af156 ("fabrics: allow tls key to be a pin") Signed-off-by: Martin George <marting@netapp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The connect command segfaults if one passes an invalid param to it. For e.g.
nvme connect disconnect
required argument [--nqn | -n] not specified
Segmentation fault (core dumped)
Running gdb on the core revealed the segfault was due to dereferencing the fctx NULL pointer:
Core was generated by `nvme connect disconnect'.
Program terminated with signal SIGSEGV, Segmentation fault. libnvmf_context_free (fctx=0x0) at ../libnvme/src/nvme/fabrics.c:222
222 free(fctx->tls_key);
(gdb) where
libnvmf_context_free (fctx=0x0) at ../libnvme/src/nvme/fabrics.c:222
cleanup_nvmf_context (fctx=0x7ffd6f16ddf8) at ../util/cleanup.h:58
fabrics_connect (desc=, argc=, argv=0x7ffd6f16ee10) at ../fabrics.c:595
handle_plugin (argc=argc@entry=2, argv=argv@entry=0x7ffd6f16ee10, plugin=0x558480 ) at ../plugin.c:190
main (argc=3, argv=0x7ffd6f16ee08) at ../nvme.c:11313
Fix the same.
Fixes: 27af156 ("fabrics: allow tls key to be a pin")