forked from linux-kdevops/linux-fork-for-kpd
-
Notifications
You must be signed in to change notification settings - Fork 0
module: Fix memory deallocation on error path in move_module() #73
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
Open
modules-kpd-app
wants to merge
3
commits into
modules-next_base
Choose a base branch
from
series/969486=>modules-next
base: modules-next_base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
The function move_module() uses the variable t to track how many memory types it has allocated and consequently how many should be freed if an error occurs. The variable is initially set to 0 and is updated when a call to module_memory_alloc() fails. However, move_module() can fail for other reasons as well, in which case t remains set to 0 and no memory is freed. Fix the problem by initializing t to MOD_MEM_NUM_TYPES. Additionally, make the deallocation loop more robust by not relying on the mod_mem_type_t enum having a signed integer as its underlying type. Fixes: c7ee8ae ("module: add stop-grap sanity check on module memcpy()") Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
All error conditions in move_module() set the return value by updating the ret variable. Therefore, it is not necessary to the initialize the variable when declaring it. Remove the unnecessary initialization. Signed-off-by: Petr Pavlu <petr.pavlu@suse.com> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
Author
|
Upstream branch: a0b018a |
6a1a12c to
7c2b408
Compare
6381fa5 to
aaa7ece
Compare
b4d1c4e to
61dc34e
Compare
1df8185 to
9aab33d
Compare
9aab33d to
99d099e
Compare
99d099e to
3aed49d
Compare
3aed49d to
856647c
Compare
856647c to
e1b99f5
Compare
e1b99f5 to
856647c
Compare
0299e02 to
cdc6b9e
Compare
Author
|
Upstream branch: 5eb4b9a Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/linux-modules/list/?series=973425 conflict: |
cdc6b9e to
311def7
Compare
311def7 to
1107cb7
Compare
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.
Pull request for series with
subject: module: Fix memory deallocation on error path in move_module()
version: 2
url: https://patchwork.kernel.org/project/linux-modules/list/?series=973425