drbd: Fix local_cnt refcount leak on ascw allocation failure in _drbd_set_state#1008
Open
blktests-ci[bot] wants to merge 1 commit into
Open
drbd: Fix local_cnt refcount leak on ascw allocation failure in _drbd_set_state#1008blktests-ci[bot] wants to merge 1 commit into
blktests-ci[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: bade58e |
7d8604f to
4cc45a3
Compare
Author
|
Upstream branch: 4edcdef |
226577b to
123f54f
Compare
4cc45a3 to
90ffd56
Compare
…_set_state In _drbd_set_state(), when transitioning a device to D_FAILED or D_DISKLESS, an extra reference on local_cnt is taken via atomic_inc(&device->local_cnt) to prevent premature destruction of the local disk. This reference is normally released by put_ldev() in after_state_ch(), which is called asynchronously through the after_state_chg_work (ascw) work item. If the GFP_ATOMIC allocation of the ascw work item fails, the work is never queued, after_state_ch() never runs, and the extra local_cnt reference is permanently leaked. Additionally, the state_change object allocated by remember_old_state() is also leaked, along with the krefs it acquired on the resource, connections, and devices. Fix both leaks in the ascw allocation failure path: - Call put_ldev() to release the extra local_cnt reference when the transition matches the same conditions used for the atomic_inc. - Call forget_state_change() to free the state_change object and release the krefs it holds. Cc: stable@vger.kernel.org Fixes: d018017 ("drbd: Remove the terrible DEV hack") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Author
|
Upstream branch: dc59e4f |
123f54f to
9b74899
Compare
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.
Pull request for series with
subject: drbd: Fix local_cnt refcount leak on ascw allocation failure in _drbd_set_state
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1116620