-
Notifications
You must be signed in to change notification settings - Fork 307
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
DAOS-7645 proc: Fix crash on error path. #5743
Conversation
Avoid a crash on free by calling D_FREE, rather than daos_prop_free(). This crash was caught by fault injection testing. Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
This fixes a crash caught by #5655 so is more urgent that the other parts of that PR, and will want backporting to 1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with current version. But probably we can recursively free internal members also.
@@ -177,7 +177,8 @@ crt_proc_daos_prop_t(crt_proc_t proc, crt_proc_op_t proc_op, daos_prop_t **data) | |||
prop->dpp_reserv = tmp; | |||
rc = crt_proc_prop_entries(proc, proc_op, prop); | |||
if (rc) { | |||
daos_prop_free(prop); | |||
D_FREE(prop->dpp_entries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to free all internal structures also.
D_FREE(prop->dpp_entries); | |
crt_proc_prop_entries(proc, CRT_PROC_FREE, prop); | |
D_FREE(prop->dpp_entries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in crt_proc_prop_entries() that the crash occurs!
Edit, no the crash is in daos_prop_entry_free_value() I'll apply your change in the other PR to see what effect it has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are lots of other minor fixes and cleanups in that PR, this is just to fix the one that has the potential to crash the client, rather than leak resources etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if crt_proc_prop_entries() failed in the middle (allocated paritial entries), then D_FREE(prop->dpp_entries) possibly cause mem leak.
looks like dmitry's suggestion is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. No errors found by checkpatch.
Avoid a crash on free by calling D_FREE, rather than daos_prop_free(). This crash was caught by fault injection testing. Signed-off-by: Ashley Pittman <ashley.m.pittman@intel.com>
Avoid a crash on free by calling D_FREE, rather than
daos_prop_free().
This crash was caught by fault injection testing.
Signed-off-by: Ashley Pittman ashley.m.pittman@intel.com