-
Notifications
You must be signed in to change notification settings - Fork 304
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-13996 pool: Fix invalid D_FREE in pool_glance #12683
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* (C) Copyright 2022 Intel Corporation. | ||
* (C) Copyright 2022-2023 Intel Corporation. | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause-Patent | ||
*/ | ||
|
@@ -84,15 +84,16 @@ pool_glance(uuid_t uuid, char *path, struct ds_pool_clue *clue_out) | |
} | ||
|
||
rc = ds_pool_svc_load(&tx, uuid, &root, &global_version, &map_buf, &clue.psc_map_version); | ||
if (rc == DER_UNINIT) { | ||
if (rc == 0) { | ||
D_FREE(map_buf); | ||
} else if (rc == DER_UNINIT) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just want to know why ds_pool_svc_load() return positive number for empty pool map instead of "-DER_UNINIT"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because that is a important, non-error scenario that will almost 100% happen during the creation of a PS, and I was afraid that functions called by ds_pool_svc_load may return If I were to make the same choice again today, I might prefer defining an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think you can do that in master independently. |
||
clue.psc_map_version = 0; | ||
rc = 0; | ||
} else if (rc != 0) { | ||
goto out_label; | ||
} | ||
|
||
memcpy(clue_out->pc_svc_clue, &clue, sizeof(clue)); | ||
D_FREE(map_buf); | ||
out_label: | ||
if (rc != 0) { | ||
D_FREE(clue_out->pc_label); | ||
|
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.
[Note] This is probably caused by previous merged with master.
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.
or set "*map_version_out = NULL" at above L1519 (rc != 0) case, seems in that case the map_buf ptr in stack possibly not init.
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.
@liuxuezhao, it is intentional that
ds_pool_svc_load
changes*map_version_out
only when returning zero. Callers shall only expect an output in*map_version_out
ifds_pool_svc_load
returns zero.