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

DAOS-7645 proc: Fix crash on error path. #5743

Merged
merged 1 commit into from
May 20, 2021
Merged

DAOS-7645 proc: Fix crash on error path. #5743

merged 1 commit into from
May 20, 2021

Conversation

ashleypittman
Copy link
Contributor

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>
@ashleypittman
Copy link
Contributor Author

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

Copy link
Contributor

@dmiter dmiter left a 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);
Copy link
Contributor

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.

Suggested change
D_FREE(prop->dpp_entries);
crt_proc_prop_entries(proc, CRT_PROC_FREE, prop);
D_FREE(prop->dpp_entries);

Copy link
Contributor Author

@ashleypittman ashleypittman May 19, 2021

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Thanks.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Collaborator

@daosbuild1 daosbuild1 left a 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.

@ashleypittman ashleypittman requested a review from a team May 20, 2021 07:03
@johannlombardi johannlombardi merged commit b65bcc6 into master May 20, 2021
@johannlombardi johannlombardi deleted the daos-7645 branch May 20, 2021 11:37
ashleypittman added a commit that referenced this pull request May 20, 2021
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>
@ashleypittman ashleypittman mentioned this pull request May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants